My program has the compiling error "could not convert 'digitalWrite(13u, 0u)' from 'void' to 'bool'." I'm finding it hard to search for a solution for this one, and I think it's because the "(13u, Ou)" is specific to people who happen to be using pin 13. Changing "digitalWrite" to "digitalRead" returns a similar error. Calling it (13, LOW) instead of (RelayPin, LOW) returns a similar error.
This is my first arduino project, and first from scratch program, and I'm looking forward to compiling and seeing how it behaves on the board. Thanks!
const byte RelayPin = 13 ; //names the pin to be used in things like digitalprint(RelayPin, HIGH) instead of using a number that you have to change in a bunch of places. 13 is the onboard LED, used for testing. Because later it will be a different pin, controlling a relay that powers an alarm
const int VibeSenseOutput = 1 ; //continuously attempts to power pin 2 through vibration sensor+resistor
const int VibeSenseInput = 2 ; //if this gets power, then it means there is a complete circuit through the vibration sensor+resistor. A strong impact which will reset the "timer" and turn off an LED
long currentMillis ; //these three lines form the basis for a kind of timer
long prevMillis ;
long interval = 10000 ;
void setup()
{
Serial.begin(9600) ; //for debugging
pinMode(RelayPin, OUTPUT) ; //declares pin as inputs/outputs
pinMode(VibeSenseOutput, OUTPUT) ; //declares pin as output
pinMode(VibeSenseInput, INPUT) ; //declares pin as Input
digitalWrite(VibeSenseOutput, HIGH) ; //sets initial states
digitalWrite(VibeSenseInput, LOW) ;
}
void loop()
{
if (VibeSenseInput == HIGH) //When an impact is detected
{
digitalWrite(RelayPin, LOW) && currentMillis = millis() ; //turn off LED (later a relay) and restart the countdown
}
{
// unsigned long currentMillis;
currentMillis = millis();
if (millis() - prevMillis >= interval) //time has expired
{
digitalWrite(RelayPin, HIGH) ; //Lights the LED (later a relay closes)
}
}
}
./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -logger humantags -fqbn arduino:avr:uno -build-cache /tmp -build-path /tmp/413177688/build -verbose -libraries /tmp/413177688/custom -libraries /tmp/413177688/pinned /tmp/413177688/try_to_compile
Compiling sketch...
/tmp/413177688/try_to_compile/try_to_compile.ino: In function 'void loop()':
/tmp/413177688/try_to_compile/try_to_compile.ino:29:31: error: could not convert 'digitalWrite(13u, 0u)' from 'void' to 'bool'
digitalWrite(RelayPin, LOW) && currentMillis = millis() //Turn off LED (later relay) off and restart the countdown
^
exit status 1