int ledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(500); // wait for a second
}
and the c code for Nerdkit is:
#define F_CPU 14745600
#include
#include
#include
#include
#include
#include
#include "../libnerdkits/delay.h"
#include "../libnerdkits/lcd.h"
int main() {
// LED as output
DDRB |= (1<
// loop keeps looking forever
while(1) {
// turn on LED
PORTB |= (1<
//delay for 300 milliseconds to let the light stay on
delay_ms(300);
// turn off LED
PORTB &= ~(1<
//delay for 800 milliseconds to let the light stay off
delay_ms(800);
}
return 0;
}
Both produce code that blinks an LED on pin PB5 of the ATmega168/328. I was able to use AVRDUDE to upload the .hex file generated by Arduino IDE to the Nerdkit and vice versa. The only tricks were getting the AVRDUDE options correct. Well, that and changed the Arduino IDE to build for 168 which the Nerdkit has. (Nifty GUI to ease uploading .hex to the Arduino found at NGCoders.)
This result should have been expected... and was. But what was proved is that the different bootloaders did not affect the outcome. At least with such a simple program.
Nerdkit on left, Arduino Duemilanove on the right, both running the identical .hex code.
No comments:
Post a Comment