Выдает ошибку
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Leonardo"
C:\Users\Kostya\ArduinoIDE1.0.6\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega32u4 -DF_CPU=16000000L -MMD -DUSB_VID=0x2341 -DUSB_PID=0x8036 -DARDUINO=106 -IC:\Users\Kostya\ArduinoIDE1.0.6\hardware\arduino\cores\arduino -IC:\Users\Kostya\ArduinoIDE1.0.6\hardware\arduino\variants\leonardo -IC:\Users\Kostya\ArduinoIDE1.0.6\libraries\SPI -IC:\Users\Kostya\ArduinoIDE1.0.6\libraries\Wire -IC:\Users\Kostya\Documents\Arduino\libraries\Adafruit-GFX-Library-master -IC:\Users\Kostya\Documents\Arduino\libraries\Adafruit_SSD1306-master C:\Users\Kostya\AppData\Local\Temp\build8495016340664567829.tmp\sketch_may31c.cpp -o C:\Users\Kostya\AppData\Local\Temp\build8495016340664567829.tmp\sketch_may31c.cpp.o
sketch_may31c.ino: In function 'void setup()':
sketch_may31c.ino:18: warning: only initialized variables can be placed into program memory area
sketch_may31c.ino: In function 'void loop()':
sketch_may31c:26: error: 'i' was not declared in this scope
Код:
#include <SPI.h> //spi library
#include <Wire.h> //i2c library
#include <Adafruit_GFX.h> //display library
#include <Adafruit_SSD1306.h> //oled library
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
}
void loop() {
display.clearDisplay(); //clear
for(i=display.width()-1; i>=0; i-=4) {
display.drawLine(display.width()-1, display.height()-1, i, 0, SSD1306_WHITE); //:)
display.display();
delay(1);
}
}
Версия IDE: Arduino 1.0.6