I’m trying to set up code for my distance sensor which uses an ultrasonic sensor and 3 LEDs.
while true
dim noPin as integer=ReadSensor(4,18)
const GLEDPin= 17
const YLEDPin= 27
const RLEDPin= 22
if Distance >= 10 then
GPIO.Pinmode( GLEDPin, GPIO.ON)
GPIO.Pinmode( YLEDPin, GPIO.OFF)
GPIO.Pinmode( RLEDPin, GPIO.OFF)
else if 10 > Distance > 6 then
GPIO.Pinmode( GLEDPin, GPIO.OFF)
GPIO.Pinmode( YLEDPin, GPIO.ON)
GPIO.Pinmode( RLEDPin, GPIO.OFF)
else if Distance < 6 then
GPIO.Pinmode( GLEDPin, GPIO.OFF)
GPIO.Pinmode( YLEDPin, GPIO.OFF)
GPIO.Pinmode( RLEDPin, GPIO.ON)
end if
GPIO.Cleanup
wend
I realise xojo coding is a bit different than python and arduino. I’m trying to run this remotely on a raspberry pi. The only problem is the " else if " and " end if " codes. What needs to be done to correct it?