This may be a question about the Arduino IDE interface, but anyway, I have the start of a new simple program that I'm trying to write myself rather than just chop up snippets of existing code. For that reason I want a better understanding of how/why this works so this is primarily an academic question.
Anyway, I've used the #define in the same way previously without trouble. (#define -some text string- then a pin) Now, as a result of a new if statement at the bottom of my program the IDE highlights the define (at the top of the code) as if that's the problem.
"too few arguments to function 'void digitalWrite(uint8_t, uint8_t)'" is my error.
Can someone help clarify? I want to get this straight in my head before proceeding. Code below:
#define RingMotor (2)
#define RingSensor 3
#define TriggerMotor 4
#define TriggerSensor 5
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(RingMotor, OUTPUT);
pinMode(RingSensor, INPUT); //RingMotor Sensor
pinMode(TriggerMotor,OUTPUT); //TriggerMotor Pin
pinMode(TriggerSensor,INPUT); //TriggerMotor Sensor
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(RingMotor, HIGH);
digitalWrite(TriggerMotor, LOW);
if (TriggerSensor>=HIGH) (digitalWrite RingMotor LOW)
}
I don't know specifically why the error shows up where it does but you will come to realise that a lot of the time the actual error and the problem the compiler sees are not in the same place. Consider, for example, a function with lots of pairs of {} but with one missing } near the start. The compiler will work through it and find pairs, they won't be the right pairs but the compiler won't notice that. Only when it gets to the next function does it notice a new function defined before the final } in the function with the error. The compiler will report that you can't define a function inside another function because that's what it sees. You have to realise what the problem really is.
Hey thanks, Perry & everybody else! Sorry for the late reply I guess I wasn't getting notified. Anyway, I got this mostly working and really its just me getting used to the interface. Thanks for explaining!