CART
  • Cart is empty.

    ItemQuantityPrice

    Total: $0

TB1LED [Arduino ATmega2560]


Code

Project includes single file tb1led.ino which contains 2 functions: setup() and loop().

Function setup() is called once when a firmware starts. It configures serial port UART1 as 115200, 8N1. Then it prints greatings message to serial port and configure digital pins as output. Software use 3 ATmega2560 pins #10, #11 and #12. They mapped to hardware pins like:

  • #10 => PB4
  •  
  • #11 => PB5
  •  
  • #12 => PB6

Please see MINI-MAX Microcontroller Board Family Interchangeable Port Mapping for more information.

All program logic presented inside loop() function. This function is called in forever loop, so we just place here code which we want execute on each call. The logic of TB1LED example is very easy:

  • turn off all 3 leds
  • wait 500ms
  • turn on all 3 leds
  • wait 500ms

This caused that 3 leds on TB-1 Training Board blinking.

Toolkit:AVR Development System

Location:\bipom\devtools\Arduino\ATmega2560\Examples\tb1\tb1led

Photos


TB-1 Training Board connected to MINI-MAX/AVR-C Board TB-1 Training Board connected to MINI-MAX/AVR-C Board
LED's on TB-1 Training Board are turned on LED's on TB-1 Training Board are turned on
Terminal window in Micro-IDE when TB1LED example is running Terminal window in Micro-IDE when TB1LED example is running

Code Example


#include "tb1led.h"


void setup() 
{ 
	Serial1.begin(115200); 

  	// prints string with ending line break 

  	Serial1.println("BiPOM Arduino"); 
  	Serial1.println("TB1LED Example"); 
  
    pinMode(GREEN_LED_PIN, OUTPUT);      
  	pinMode(YELLOW_LED_PIN, OUTPUT);      
  	pinMode(RED_LED_PIN, OUTPUT);
} 


void loop() 
{ 
	// Turn on the LED's on TB-1

	digitalWrite(GREEN_LED_PIN, LOW);
	digitalWrite(YELLOW_LED_PIN, LOW);
	digitalWrite(RED_LED_PIN, LOW);
	delay(LED_DELAY);

	// Turn off the LED's on TB-1

	digitalWrite(GREEN_LED_PIN, HIGH);
	digitalWrite(YELLOW_LED_PIN, HIGH);
	digitalWrite(RED_LED_PIN, HIGH);
	delay(LED_DELAY);
}