k

edited May 2017 in Arduino

k

Answers

  • Please edit your post and format your code. Select your code and press ctrl+o and have an empty line above and below your code.

    Kf

  • edited February 2017

    im stuck on line 36 like i dont know what to do after this what command should i use??

  • In line 37 you want line 17 and also set a boolean playMovie to true here which you then use in line 41 above

  • You declare a global boolean variable indicating if you video is playing or not. When the value goes beyond the threshold, you set the boolean value to true and call the movie's play() function.

    boolena isPlaying=false;  //Global access
    (...) 
    (...)
    (...)
    if (result1 > 30  && isPlaying==false) {
       isPlaying=true;
       myMovie.play();
    }
    

    Having the boolean value checked in the conditional is important so in case your sensor goes above 30 a second time, it does not call play movie again.

    Kf

  • (...) (...) (...)

    what should i put in them?

  • @james

    Sorry, that means any previous code. I just wanted to emphasize the usage of a global variable. The changes I suggest needs to be implemented in line 36 of your code. Please also follow @Chrisir's direction.

    Kf

  • but is that needed ? and chris direction line 37 and 17 in empty

  • im going to try it now and lets see what happens

  • edited February 2017

    jjjjjjjjjjjjjjjj

  • you did it wrong.

  • chrisir so what can i do? please this really urgent and this is my first time coding i am so sorry for the troubles.

  • edited February 2017 Answer ✓

    you need to rethink your usage of isPlaying

  • chriss omg your a legend mate, thank you soooooooooooooo much

  • edited February 2017 Answer ✓

    also please use ctrl-t in processing to auto-format your code

    Global access means it is declared before setup(): boolean isPlaying=false; must be before setup()

    Further remarks

    • You also kept this myMovie.play(); in setup which started the movie immediately. Bad.

    • You also had this image(myMovie, 0, 0); without the if-clause if (isPlaying) { // !!!. Bad.

    • remove all !!!! now

    by the way

    • This isPlaying==false is the same as !isPlaying

    • This if (isPlaying==true) { is the same as if (isPlaying) {

  • edited May 2017

    h

  • no. Sorry, it's meant to stay for others to learn

  • edited May 2017

    m.

  • edited May 2017

    p

Sign In or Register to comment.