OK, so i followed your instructions and was successful at having the IDE verify the code. But i uploaded it and, nothing happens.
I tried loading the zip library for the UVmeter as it came from the site, but IDE was having none of it, the error reads (Specified folder/zip file does not contain a valid library) so I unzipped it (reluctantly) and then loaded the .ino file and 2 .c files that opened in separate tabs . The LCD zip was added to the IDE as instructed without a flaw, and when i clicked on it, the IDE showed:
#include <LCD5110_Graph.h>
In the end the software i uploaded to the uno is as follows( I added the 3 ` thingies before and after as the forum bot said):
in the first tab called UVMeter:
#include <LCD5110_Graph.h>
#include <LCD5110_Graph.h>
//////////////////////////////////////////////
// Arduino UV Meter //
// with NOKIA 5110 LCD //
// http://www.educ8s.tv //
/////////////////////////////////////////////
#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;
}
In the second tab called splash.c there is this:
#include <avr/pgmspace.h>
const unsigned char splash []PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xF0, 0x00, 0x00, 0x80, 0xE0, 0x80,
0x00, 0x00, 0x00, 0xC0, 0xE0, 0xE0, 0xE0, 0xFC, 0xF8, 0x00, 0xC0, 0x80, 0x00, 0x00, 0x80, 0xC0,
0xF8, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00,
0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x80, 0xCF, 0xFF, 0xFF, 0x7F,
0x3E, 0x1D, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03,
0x07, 0x07, 0x0F, 0x0F, 0x17, 0x33, 0xF1, 0xFC, 0xE4, 0xC0, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF,
0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0C, 0x1E, 0x3E, 0xFC, 0xFD,
0x1D, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0F, 0xFF, 0xFC, 0x7C,
0x3C, 0x3C, 0x3C, 0x78, 0xE0, 0xC0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x3F,
0x7F, 0x70, 0x70, 0x7F, 0x7F, 0x3F, 0x1F, 0x00, 0x00, 0x00, 0x01, 0x7F, 0x7F, 0x7F, 0x7C, 0x7F,
0x7F, 0x7F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x18,
0x38, 0x79, 0xFB, 0xFF, 0xFC, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0,
0xF8, 0xFF, 0xC7, 0x03, 0x03, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0xE0,
0x00, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0xE0, 0xE0, 0x60, 0x60, 0x00, 0x60, 0x60, 0xE0, 0xE0, 0x60,
0x60, 0x00, 0xE0, 0xE0, 0x60, 0x60, 0x00, 0x00, 0xE0, 0xE0, 0x60, 0x60, 0xE0, 0xC0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x9F, 0x9F, 0xCF, 0xFC, 0xFC, 0xF8, 0xF0,
0x30, 0x20, 0x60, 0x60, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0x20, 0x20, 0xF0, 0xF0, 0xF8, 0xB8,
0x0C, 0x0E, 0x09, 0x03, 0x07, 0x0F, 0x0C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0x01, 0xFF, 0xFE, 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xC6, 0xC6, 0xC0, 0x00,
0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC6, 0xC6, 0xC0, 0x00, 0xFF, 0xFF, 0x06, 0x06,
0xFF, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x03,
0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00,
0x01, 0x03, 0x03, 0x03, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
And in the third tab called ui.c there is this:
#include <avr/pgmspace.h>
const unsigned char ui []PROGMEM = {
0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0x01, 0x1D, 0xFD, 0xE1, 0x01, 0xE1, 0xFD, 0x1D,
0x01, 0x01, 0x01, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xF1, 0x81, 0xFD, 0xFD, 0x01, 0x01, 0xFD,
0xFD, 0x0D, 0x0D, 0xFD, 0xF9, 0x01, 0x01, 0xFD, 0xFD, 0xCD, 0xCD, 0x01, 0x01, 0x0D, 0xFD, 0xC1,
0xFD, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0xFF, 0xFF, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4F, 0x5F, 0x58, 0x58, 0x5F, 0x4F, 0x40, 0x40, 0x47, 0x5F,
0x58, 0x5F, 0x47, 0x40, 0x40, 0x40, 0x40, 0x5F, 0x5F, 0x40, 0x40, 0x5F, 0x5F, 0x40, 0x47, 0x5F,
0x5F, 0x40, 0x40, 0x5F, 0x5F, 0x58, 0x58, 0x5F, 0x4F, 0x40, 0x40, 0x5F, 0x5F, 0x58, 0x58, 0x58,
0x40, 0x5C, 0x5F, 0x40, 0x5F, 0x5C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFF,
};
In terms of my hardware, the only thing that hasn't showed signs of life yet is the LCD_5110 i just bought from somewhere in canada, it looks well, but i did not try to check it on its own ( not that i could have done it before you guys told me how to load the software), but i saw a backlight flash when this program loaded, just for a second and again if i hit the white reset button in the UNO. The Arduino Uno seems to work, we ran a few of the simple projects in the starter kit and had a couple sensors tested alone. I had tested the SMAKN UVM-30A sensor alone before with simple code from electropeak,
/*
UVM30A-UV-Module
Made on 02 Feb 2020
by Amir Mohammad Shojaee @ Electropeak
Home
*/
void setup(){
Serial.begin(9600);
}
void loop()
{
int sensorValue;
sensorValue=analogRead(A0);
Serial.print("The voltage value:");
Serial.print(sensorValue*5000/1023.0);
Serial.println("mV");
delay(1000);
Serial.print("\n");
}
it worked, gave me some weird readings on the serial screen, but i was indoors at night, so i assumed that was it (I got something similar from a GUVA-S12SD sensor i bought as a backup).
So, although i think i made some progress, I am still stuck, and worst of all is I have no Idea why or how, and much less how to approach the problem. So I would appreciate like a big lot if someone out there can give me a hand. I am sorry for the long message, I just wanted to pour as much info as possible since I don't know what is helpful and what is not.
Thank you again.