Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*********************************************************************
- Learnelectronics
- Arduino Nano Experimentor's Board Test Script
- July 14,2020
- https://www.youtube.com/learnelectronics
- email: [email protected]
- *********************************************************************/
- #include <SPI.h>
- #include <Wire.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_SSD1306.h>
- #define OLED_RESET 4
- Adafruit_SSD1306 display(OLED_RESET);
- #define NUMFLAKES 10
- #define XPOS 0
- #define YPOS 1
- #define DELTAY 2
- #define LOGO16_GLCD_HEIGHT 16
- #define LOGO16_GLCD_WIDTH 16
- static const unsigned char PROGMEM logo16_glcd_bmp[] =
- { B00000000, B11000000,
- B00000001, B11000000,
- B00000001, B11000000,
- B00000011, B11100000,
- B11110011, B11100000,
- B11111110, B11111000,
- B01111110, B11111111,
- B00110011, B10011111,
- B00011111, B11111100,
- B00001101, B01110000,
- B00011011, B10100000,
- B00111111, B11100000,
- B00111111, B11110000,
- B01111100, B11110000,
- B01110000, B01110000,
- B00000000, B00110000 };
- #if (SSD1306_LCDHEIGHT != 64)
- #error("Height incorrect, please fix Adafruit_SSD1306.h!");
- #endif
- void setup() {
- Serial.begin(9600);
- // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
- display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
- // init done
- // Show image buffer on the display hardware.
- // Since the buffer is intialized with an Adafruit splashscreen
- // internally, this will display the splashscreen.
- display.display();
- delay(2000);
- // Clear the buffer.
- display.clearDisplay();
- pinMode(5,OUTPUT);
- pinMode(6,OUTPUT);
- pinMode(9,OUTPUT);
- pinMode(4,INPUT);
- pinMode(7,INPUT);
- pinMode(8,INPUT);
- digitalWrite(5,LOW);
- digitalWrite(6,LOW);
- digitalWrite(9,LOW);
- }
- void loop() {
- display.clearDisplay();
- display.setCursor(0,0);
- display.setTextSize(2);
- display.setTextColor(WHITE);
- display.print("hola");
- display.display();
- Serial.print(digitalRead(4));
- if (digitalRead(4)==0){
- digitalWrite(5,HIGH);
- delay(10);
- }
- else{
- digitalWrite(5,LOW);
- }
- if (digitalRead(7)==0){
- display.clearDisplay();
- display.setCursor(0,0);
- display.setTextSize(2);
- display.setTextColor(WHITE);
- display.print("D7 is low");
- display.display();
- delay(500);
- }
- if (digitalRead(8)==0){
- digitalWrite(6,HIGH);
- delay(50);
- digitalWrite(6,LOW);
- digitalWrite(9,HIGH);
- delay(50);
- digitalWrite(9,LOW);
- digitalWrite(6,HIGH);
- delay(50);
- digitalWrite(6,LOW);
- digitalWrite(9,HIGH);
- delay(50);
- digitalWrite(9,LOW);
- digitalWrite(6,HIGH);
- delay(50);
- digitalWrite(6,LOW);
- digitalWrite(9,HIGH);
- delay(50);
- digitalWrite(9,LOW);
- digitalWrite(6,HIGH);
- delay(50);
- digitalWrite(6,LOW);
- digitalWrite(9,HIGH);
- delay(50);
- digitalWrite(9,LOW);
- digitalWrite(6,HIGH);
- delay(50);
- digitalWrite(6,LOW);
- digitalWrite(9,HIGH);
- delay(50);
- digitalWrite(9,LOW);
- digitalWrite(6,HIGH);
- delay(50);
- digitalWrite(6,LOW);
- digitalWrite(9,HIGH);
- delay(50);
- digitalWrite(9,LOW);
- }
- else{
- digitalWrite(5,LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement