Hi all.
I copied and pasted the sketch below into the Arduino IDE, when i try to upload the sketch i get the errors below, i am using a UNO R3, with a UVM30A UV index sensor + NOKIA 5110 LCD.
#include <LCD5110_Graph.h>
LCD5110 lcd(8,9,10,12,11);
extern unsigned char BigNumbers[];
extern uint8_t splash[];
extern uint8_t ui[];
String UV = "0";
void setup() {
lcd.InitLCD();
lcd.setFont(BigNumbers);
lcd.clrScr();
lcd.drawBitmap(0, 0, splash, 84, 48);
lcd.update();
delay(3000);
}
void loop() {
int stringLength = 0;
UV = readSensor();
lcd.clrScr();
lcd.drawBitmap(0, 0, ui, 84, 48);
stringLength = UV.length();
printUV(stringLength);
lcd.update();
delay(150);
}
void printUV(int length)
{
switch(length)
{
case 1: lcd.print(UV,38,19); break;
case 2: lcd.print(UV,24,19); break;
default: lcd.print(UV,0,19); break;
}
}
String readSensor()
{
String UVIndex = "0";
int sensorValue = 0;
sensorValue = analogRead(0); //connect UV sensor to Analog 0
int voltage = (sensorValue * (5.0 / 1023.0))*1000; //Voltage in miliVolts
if(voltage<50)
{
UVIndex = "0";
}else if (voltage>50 && voltage<=227)
{
UVIndex = "0";
}else if (voltage>227 && voltage<=318)
{
UVIndex = "1";
}
else if (voltage>318 && voltage<=408)
{
UVIndex = "2";
}else if (voltage>408 && voltage<=503)
{
UVIndex = "3";
}
else if (voltage>503 && voltage<=606)
{
UVIndex = "4";
}else if (voltage>606 && voltage<=696)
{
UVIndex = "5";
}else if (voltage>696 && voltage<=795)
{
UVIndex = "6";
}else if (voltage>795 && voltage<=881)
{
UVIndex = "7";
}
else if (voltage>881 && voltage<=976)
{
UVIndex = "8";
}
else if (voltage>976 && voltage<=1079)
{
UVIndex = "9";
}
else if (voltage>1079 && voltage<=1170)
{
UVIndex = "10";
}else if (voltage>1170)
{
UVIndex = "11";
}
return UVIndex;
}
[codeArduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"
C:\Users\dell\AppData\Local\Temp\ccidaCy7.ltrans0.ltrans.o: In function `setup':
C:\Users\dell\Downloads\FBU7AFWISCBNOLH/FBU7AFWISCBNOLH.ino:21: undefined reference to `splash'
C:\Users\dell\Downloads\FBU7AFWISCBNOLH/FBU7AFWISCBNOLH.ino:21: undefined reference to `splash'
C:\Users\dell\AppData\Local\Temp\ccidaCy7.ltrans0.ltrans.o: In function `loop':
C:\Users\dell\Downloads\FBU7AFWISCBNOLH/FBU7AFWISCBNOLH.ino:33: undefined reference to `ui'
C:\Users\dell\Downloads\FBU7AFWISCBNOLH/FBU7AFWISCBNOLH.ino:33: undefined reference to `ui'
collect2.exe: error: ld returned 1 exit status
.[/code]