In this project we will simulate a bargraph with LEDs that is level controlled by a potentiometer. The value of the potentiometer (0-1023) will be converted to a 10 LEDs range with the map instruction. This example can be found by the examples provided in the simulator under ‘Display’. The steps are shown in the video above.
Select the used inputs and outputs on the simulator. In this case we use LEDs on digital pins 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11. The potentiometer is connected to analog pin A0. Connect the Arduino with the COM port in the simulator and start simulating.
You can restore saved setups by going under File and choose for ‘Restore settings’. Select the setup file and all the saved settings will be restored. The file is called ‘Bargraph’.
Adjust the codes with a capital letter so that they can be used by the library like you did in the previous projects. Then upload your code and start the simulation.
The instructions that communicate with the simulator are based on similar Arduino codes. Only the first letter needs to be replaced by a capital letter, remove the dot in the instruction with a dot ‘.’ and your ready to simulate.
The simulator library codes are as follows:
digitalWrite becomes DigitalWrite
lcd.print becomes lcdprint
Instructions Arduino IDE Instructions Arduino IO Simulator
tone(x,y ,z); Tone(x,y ,z);