/* Project: Float switch Function: Testing of the sensor. When float switch is up, serial monitor will print "1" and when float is down it will print "0" */ const int floatswitchpin = 7;//float switch attached to digital pin 7 of Arduino Uno void setup() { pinMode(floatswitch,INPUT_PULLUP); Serial.begin(9600);//initialise serial communication at 9600 bps } void loop() { int x = digitalRead(floatswitchpin);//het the value Serial.println(x);//prints in serial monitor }