This is the code
// Pin for LEDs
#define LEDGREEN 10
#define LEDYELLOW 11
#define LEDRED 12
#define ANALOGBATTERY0
// variables
int analogValue = 0;
float voltage = 0;
int ledDelay = 800;
// threshhold
maximum float = 1.6;
medium float = 1.4;
minimum float = 0.3;
void setup () {
//We start the serial monitor
Serial.begin (9600);
// LED pins in output mode
pinMode (LEDGREEN, OUTPUT);
pinMode (YELLOW LED, OUTPUT);
pinMode (RED LED, OUTPUT);
}
void loop (){
// WE read the value of the analog input
analogValue =analogReald (ANALOGBATTERY);
//We get the voltage
voltage = 0.0048 * analogValue;
Serial.print ("Voltage:");
Serial.println (voltage);
// Depending on the voltage we show one LED or another
if (voltage> = maximum)
{
digitalWrite (LEDGREEN, HIGH);
delay (ledDelay);
digitalWrite (LEDGREEN, LOW);
}
els if (voltage <maximum && voltage> average)
{
digitalWrite (YELLOW LED, HIGH);
delay (led Delay);
digitalWrite (YELOW LED, LOW);
}
else if (voltage <medium && voltage> minimum)
}
// WE turn off all LEDs
digitalWrite (LEDVERDE, LOW);
digitalwrite (YELLOW LED, LOW);
digitalwrite (RED LED, LOW);
This is the error message we keep getting
Arduino: 1.8.12 (Windows 10), Board: "Arduino Uno"
SiennaRbattres:16:1: error: 'maximum' does not name a type
maximum float = 1.6;
^~~~~~~
SiennaRbattres:17:1: error: 'medium' does not name a type; did you mean 'memmem'?
medium float = 1.4;
^~~~~~
memmem
SiennaRbattres:18:1: error: 'minimum' does not name a type
minimum float = 0.3;
^~~~~~~
C:\Users\nxtechuser\Documents\Arduino\SiennaRbattres\SiennaRbattres.ino: In function 'void setup()':
SiennaRbattres:26:10: error: 'YELLOW' was not declared in this scope
pinMode (YELLOW LED, OUTPUT);
^~~~~~
C:\Users\nxtechuser\Documents\Arduino\SiennaRbattres\SiennaRbattres.ino:26:10: note: suggested alternative: 'LEDYELLOW'
pinMode (YELLOW LED, OUTPUT);
^~~~~~
LEDYELLOW
SiennaRbattres:27:10: error: 'RED' was not declared in this scope
pinMode (RED LED, OUTPUT);
^~~
C:\Users\nxtechuser\Documents\Arduino\SiennaRbattres\SiennaRbattres.ino: In function 'void loop()':
SiennaRbattres:33:29: error: 'ANALOGBATTERY' was not declared in this scope
analogValue =analogReald (ANALOGBATTERY);
^~~~~~~~~~~~~
C:\Users\nxtechuser\Documents\Arduino\SiennaRbattres\SiennaRbattres.ino:33:29: note: suggested alternative: 'ANALOGBATTERY0'
analogValue =analogReald (ANALOGBATTERY);
^~~~~~~~~~~~~
ANALOGBATTERY0
SiennaRbattres:33:16: error: 'analogReald' was not declared in this scope
analogValue =analogReald (ANALOGBATTERY);
^~~~~~~~~~~
C:\Users\nxtechuser\Documents\Arduino\SiennaRbattres\SiennaRbattres.ino:33:16: note: suggested alternative: 'analogRead'
analogValue =analogReald (ANALOGBATTERY);
^~~~~~~~~~~
analogRead
SiennaRbattres:41:16: error: expected primary-expression before '=' token
if (voltage> = maximum)
^
SiennaRbattres:41:18: error: 'maximum' was not declared in this scope
if (voltage> = maximum)
^~~~~~~
SiennaRbattres:47:1: error: 'els' was not declared in this scope
els if (voltage <maximum && voltage> average)
^~~
C:\Users\nxtechuser\Documents\Arduino\SiennaRbattres\SiennaRbattres.ino:47:1: note: suggested alternative: 'gets'
els if (voltage <maximum && voltage> average)
^~~
gets
SiennaRbattres:53:1: error: 'else' without a previous 'if'
else if (voltage <medium && voltage> minimum)
^~~~
SiennaRbattres:53:20: error: 'medium' was not declared in this scope
else if (voltage <medium && voltage> minimum)
^~~~~~
C:\Users\nxtechuser\Documents\Arduino\SiennaRbattres\SiennaRbattres.ino:53:20: note: suggested alternative: 'memmem'
else if (voltage <medium && voltage> minimum)
^~~~~~
memmem
SiennaRbattres:53:39: error: 'minimum' was not declared in this scope
else if (voltage <medium && voltage> minimum)
^~~~~~~
SiennaRbattres:54:1: error: expected primary-expression before '}' token
}
^
C:\Users\nxtechuser\Documents\Arduino\SiennaRbattres\SiennaRbattres.ino: At global scope:
SiennaRbattres:57:14: error: expected constructor, destructor, or type conversion before '(' token
digitalWrite (LEDVERDE, LOW);
^
SiennaRbattres:58:14: error: expected constructor, destructor, or type conversion before '(' token
digitalwrite (YELLOW LED, LOW);
^
SiennaRbattres:59:14: error: expected constructor, destructor, or type conversion before '(' token
digitalwrite (RED LED, LOW);
^
SiennaRbattres:60:1: error: expected declaration before '}' token
}
^
exit status 1
'maximum' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.