pcbway




Arduino Lilypad Simulation in Proteus, Arduino Lilypad Project in Proteus, Arduino Lilypad in Proteus, Arduino Lilypad Proteus design,Arduino lilypad with proteusYesterday, I have posted a new Arduino Lilypad / Nano Library for Proteus in which we have seen how to add that library into Proteus so that you could be able to use these boards in Proteus. That was quite easy. Today I am gonna post a small project in which we will see how to use that library and produce an Arduino Lilypad simulation in Proteus. In this Arduino Lilypad simulation in Proteus, I am gonna use obviously he Arduino Lilypad board along with few LED lightsand will make them blink. Its also quite easy and you can also download the simulation and the hex file at the end of this project but I would suggest you to do it yourself so that you learn something out of it.

Before starting this project, you must have first integrated the Arduino Lilypad Library as without it you wont be abe to do this project. So, if you haven’t downloaded it yet then you should read the previous post Arduino Lilypad / Nano Library for Proteus first. Lets get started with this project.

Arduino Lilypad Simulation in Proteus

  • Now I assue that you have already downloaded the Arduino Lilypad Library for Proteus and are ready to use it within Proteus.
  • So open Proteus ISIS and get these components from the Proteus components library as shown in below figure:

Arduino Lilypad Simulation in Proteus, Arduino Lilypad Project in Proteus, Arduino Lilypad in Proteus, Arduino Lilypad Proteus design,Arduino lilypad with proteus

  • After getting these components, draw a circuit in Proteus as shown in the below figure:

Arduino Lilypad Simulation in Proteus, Arduino Lilypad Project in Proteus, Arduino Lilypad in Proteus, Arduino Lilypad Proteus design,Arduino lilypad with proteus

  • You can clearly see in the above figure, the Arduino Lilypad Simulation in Proteus. After that you need to write a code for Arduino Lilypad so that you could get the hex file for it.
  • In this project, I have used three LED lights and make them ON and OFF using the switch button. If the button is not pressed then the LEDs will remain ON and when you hit the button , the LEDs will go OFF.
  • Copy the below code and paste it into the Arduino software and compile.

int analogPin = A0;
int ledCount = 3;

int ledPins[] = {
2, 3, 4};

void setup() {
// loop over the pin array and set them all to output:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
pinMode(ledPins[thisLed], OUTPUT);
}
}

void loop() {
// read the potentiometer:
int sensorReading = analogRead(analogPin);
// map the result to a range from 0 to the number of LEDs:
int ledLevel = map(sensorReading, 0, 1023, 0, ledCount);

// loop over the LED array:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
// if the array element’s index is less than ledLevel,
// turn the pin for this element on:
if (thisLed < ledLevel) {
digitalWrite(ledPins[thisLed], HIGH);
}
// turn off all pins higher than the ledLevel:
else {
digitalWrite(ledPins[thisLed], LOW);
}
}
}

  • After compiling this code, get the hex file of code. The hex file and this simulation file is also given at the end of this post so you can download it from there.
  • Now upload this hex file into this Arduino Lilypad and hit the RUN button

Note:

  • If everything’s goes fine then as youhit the run button, the LEDs will get ON as shown in the below figure:

Arduino Lilypad Simulation in Proteus, Arduino Lilypad Project in Proteus, Arduino Lilypad in Proteus, Arduino Lilypad Proteus design,Arduino lilypad with proteus

  • Now, when you press the button, these LEDs will go OFF as shown in the below figure:

Arduino Lilypad Simulation in Proteus, Arduino Lilypad Project in Proteus, Arduino Lilypad in Proteus, Arduino Lilypad Proteus design,Arduino lilypad with proteus

  • That’s all, you have successfully implemented the Arduino Lilypad simulation in Proteus. 🙂
  • In order to download this simulation and the hex file, click on the below buttons.

Download Simulation

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment