Simple LED blinking example

Connect LED to PB0 and the other wire of the LED to ground with the following code:

#include "main.h"
using namespace compatArduino;
int LedPin = PB0; // PB0 pin is connected to Led
int main()
doInit(); // Initialize the program
pinMode(LedPin,OUTPUT); // set pin mode to OUTPUT
	while(1) // loop forever
		digitalWrite(LedPin,HIGH); // Turn LED on
		delay(1000); // wait here for 1 second
		digitalWrite(LedPin,LOW); // Turn LED off
		delay(1000); // wait here for 1 second
Be Sociable, Share!
  1. No comments yet.
(will not be published)