Skip to content

Commit

Permalink
Merge pull request #58 from vanvuongngo/patch-1
Browse files Browse the repository at this point in the history
prettier drawline.ino example
  • Loading branch information
bitsk authored Oct 11, 2019
2 parents 6f7873a + 4dd21db commit 31fa216
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions libraries/NS2009/examples/drawline/drawline.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void setup()
pinMode(key, INPUT);
lcd.begin(15000000, COLOR_RED);
touchscreen.begin();
touchscreen.calibrate(320,240);
touchscreen.calibrate(320, 240);
}

void loop()
Expand All @@ -29,20 +29,16 @@ void loop()
touchscreen_status = touchscreen.getStatus();
touchscreen_x = touchscreen.getX();
touchscreen_y = touchscreen.getY();
if(draw){
if (draw) {
lcd.writeLine(x_last,y_last,touchscreen_x,touchscreen_y,COLOR_WHITE);
}
if(status_last!=touchscreen_status){
if (touchscreen_status == TOUCH_BEGIN || touchscreen_status == TOUCH_MOVE)
draw = true;
else
draw = false;
status_last=touchscreen_status;
if (status_last != touchscreen_status) {
draw = (touchscreen_status == TOUCH_BEGIN || touchscreen_status == TOUCH_MOVE);
status_last = touchscreen_status;
}
x_last = touchscreen_x;
y_last = touchscreen_y;
if(digitalRead(key) == LOW)
{
if (digitalRead(key) == LOW) {
lcd.fillScreen(COLOR_BLACK);
}
}

0 comments on commit 31fa216

Please sign in to comment.