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:
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:
This caused that 3 leds on TB-1 Training Board blinking.
Toolkit:AVR Development System
Location:\bipom\devtools\Arduino\ATmega2560\Examples\tb1\tb1led
#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); }