timer - Ticker to call functions periodically (C++) -


so these tickers call each respective lane function respectively:

ticker.attach(&lane1,0.5); ticker2.attach(&lane2,1.5); ticker3.attach(&lane3,4.5);

and these lane functions:

void lane1(){ (int y = 0; y < width ; y+=4) {        lcd.setpixel(33,y);        lcd.setpixel(51,y);           } (int y = 1; y < width ; y+=4) {        lcd.setpixel(33,y);        lcd.setpixel(51,y);           }  (int y = 2; y < width ; y+=4) {        lcd.setpixel(33,y,false);        lcd.setpixel(51,y,false);           } (int y = 3; y < width ; y+=4) {        lcd.setpixel(33,y,false);        lcd.setpixel(51,y,false);         }        }  void lane2(){ (int y = 0; y < width ; y+=4) {        lcd.setpixel(33,y,false);        lcd.setpixel(51,y,false);           } (int y = 1; y < width ; y+=4) {        lcd.setpixel(33,y);        lcd.setpixel(51,y);           } (int y = 2; y < width ; y+=4) {        lcd.setpixel(33,y);        lcd.setpixel(51,y);         }   (int y = 3; y < width ; y+=4) {        lcd.setpixel(33,y,false);        lcd.setpixel(51,y,false);           }         }   void lane3(){ (int y = 0; y < width ; y+=4) {        lcd.setpixel(33,y,false);        lcd.setpixel(51,y,false);           } (int y = 1; y < width ; y+=4) {        lcd.setpixel(33,y,false);        lcd.setpixel(51,y,false);           }  (int y = 2; y < width ; y+=4) {        lcd.setpixel(33,y);        lcd.setpixel(51,y);           } (int y = 3; y < width ; y+=4) {        lcd.setpixel(33,y);        lcd.setpixel(51,y);         }   } 

my aim try , render 2 dashed lines on monochrome lcd screen lines move downwards (to represent moving road markings). i've tried using 3 tickers call 3 functions dashes 2 pixels in length , 2 pixels apart.

the dashed lines, however, don't , understand it's because calling of functions overlap don't know how else it.

edit: ticker ticker call functions periodically (c++) can found here: https://developer.mbed.org/handbook/ticker


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -