Arduino IDE 1.0.5 + UNO + Adafruit 1.8" TFT Shield / drawFastVline x 8 x 10000, then hang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| TFT demo | |
| https://github.com/arduino/TFT | |
| http://arduino.cc/en/Reference/TFTLibrary | |
| */ | |
| // randomdot | |
| #include <TFT.h> | |
| #include <SPI.h> | |
| #define TFT_CS 10 | |
| #define TFT_DC 8 | |
| #define TFT_RST NULL | |
| #define TFT_SCLK 13 | |
| #define TFT_MOSI 11 | |
| #define SD_CS 4 | |
| Adafruit_ST7735 screen = TFT(TFT_CS, TFT_DC, TFT_RST); // for UNO | |
| /// TFT screen = TFT(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); // for Leonardo | |
| void setup(void) { | |
| Serial.begin(9600); | |
| while(!Serial); | |
| Serial.println("START"); | |
| SPI.setClockDivider(SPI_CLOCK_DIV4); // SPI speed | |
| screen.initR(INITR_BLACKTAB); | |
| screen.setRotation(3); | |
| screen.fillScreen(ST7735_BLACK); | |
| // screen.begin(); | |
| // screen.background(0,0,0); | |
| // screen.fill(255,255,255); | |
| } | |
| const int XMAX=ST7735_TFTHEIGHT; | |
| const int YMAX=ST7735_TFTWIDTH; | |
| unsigned long counter=0; | |
| void loop() { | |
| int x1,y1,x2,y2,c,t; | |
| unsigned long stime,etime; | |
| stime=millis(); | |
| c=random(65536); | |
| for(int i=1;i<=10000;i++) { | |
| x1=random(0,XMAX); | |
| y1=random(0,YMAX); | |
| x2=random(0,XMAX); | |
| y2=random(0,YMAX); | |
| t=abs(y1-y2); | |
| screen.drawFastVLine(x1,y1,t,c); | |
| screen.drawFastVLine(x1,y1,t,c); | |
| screen.drawFastVLine(x1,y1,t,c); | |
| screen.drawFastVLine(x1,y1,t,c); | |
| screen.drawFastVLine(x1,y1,t,c); | |
| screen.drawFastVLine(x1,y1,t,c); | |
| screen.drawFastVLine(x1,y1,t,c); | |
| screen.drawFastVLine(x1,y1,t,c); | |
| } | |
| etime=millis(); | |
| counter++; | |
| Serial.println(counter); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment