Having problems with a code from my begginers guide book to Arduino.
The code was working fine to beggin with, but (seemingly) without me doing any change to the code it stop working. I think the problem is connected to the "U8gilb" library.
I case i was not obvious i am new to Arduino (and coding in general)
My code:
#include "U8glib.h"
U8GLIB_SSD1306_128X64 oled(U8G_I2C_OPT_NONE);
int n=0;
void loop(){
//Refresh picture
oled.firstPage();
do {
draw();
}while(oled.nextPage());
//Continue drawing line until n<30
if(n < 30) {
n++;
}
//Wait 5000 ms and then remove line
else{
delay (5000);
n = 0;
}
}
void draw() {
//Draw pixels
oled.drawPixel (11, 44);
oled.drawPixel (13, 44);
//Draw line
oled.drawLine(12, 28, 12, 60);
oled.drawLine(12, 60, 127, 60);
oled.drawLine(12, 60, 12 + n*4, 60-n);
//Print strings
oled.drawStr(0,10, "My Arduino");
oled.drawStr(0,23, "knowledge");
oled.drawStr(0,60, "0");
oled.drawStr(0,40, "1");
}
Errors:
Arduino:1.8.8 (Windows Store 1.8.19.0) (Windows 10), Kort"Arduino/Genuino Uno"
C:\Users\Henni\AppData\Local\Temp\ccz4ZLaJ.ltrans0.ltrans.o: In function `main':
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Help would be much appreciated