Would someone mind helping on this error? I can’t seem to narrow it down in the previous threads on this subject. Thank you in advance!
Please read the forum guide in the sticky post at the top of almost any forum section. Your post is breaking several rules!
It is almost impossible to help when you post an image of code.
Please post your code by copy and paste... use the code tag option in the editor window...
Also post the full error message you receive. Click this button...
then also paste as above.
Thank you for your patience as I’m brand new to the forum. I will get logged in on the pc that I’m using and do what you said.
Ok- Please let me know what else I need to do or do correctly. I am using an ELEGOO UNO R3.
Thanks in advance!Preformatted text
[code]
int myPin=A2;
int readVal;
float V2;
int dt=250;
int redPin=9;
void setup() {
// put your setup code here, to run once:
pinMode(redPin.OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
readVal=analogRead(myPin);
V2=(5./1023.)*readVal;
Serial.print("Potentiometer Voltage is ");
Serial.println(V2);
if (V2>4.0) {
digitalWrite(redPin,HIGH);
}
if (V2<4.0) {
digitalWrite(redPin,LOW);
}
delay(dt);
}
[/code]
ERROR MESSAGE:
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Uno"
In file included from sketch\WARNING_LED.ino.cpp:1:0:
C:\Users\LAM\Documents\Arduino\
WARNING_LED\WARNING_LED\WARNING_LED.ino: In function 'void setup()':
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:44:16: error: expected unqualified-id before numeric constant
#define OUTPUT 0x1
^
C:\Users\LAM\Documents\Arduino\WARNING_LED\WARNING_LED\WARNING_LED.ino:11:16: note: in expansion of macro 'OUTPUT'
pinMode(redPin.OUTPUT);
^~~~~~
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Hey I was able to figure this out so please don't waste your time on it. I am so new I did not even know that the error window scrolled up!
Appreciate you schooling me on how to post...I 'll get there!
So you figured out that you should use a comma, not a period, between arguments to a function. Good work.
Yes- the old typo got me. Thanks again!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.