What is Arduino
8 - 2 MSP430 Workshop - Using Energia (Arduino)
Chapter Topics
Using Energia (Arduino) ............................................................................................................. 8-1
What is Arduino ......................................................................................................................... 8-3
Energia ...................................................................................................................................... 8-4
Programming Energia (and Arduino) ........................................................................................ 8-7
Programming with ‘Wiring’ .................................................................................................... 8-7
Wiring Language/Library Reference ..................................................................................... 8-8
How Does ‘Wiring’ Compare? ............................................................................................... 8-9
Hardware pinout .................................................................................................................. 8-10
Energia IDE ............................................................................................................................. 8-12
Examples, Lots of Examples ............................................................................................... 8-13
Energia/Arduino References ................................................................................................... 8-14
Lab 8 ....................................................................................................................................... 8-15
Installing Energia ................................................................................................................. 8-16
Installing the LaunchPad drivers ..................................................................................... 8-16
Installing Energia ............................................................................................................. 8-16
Starting and Configuring Energia .................................................................................... 8-17
Lab 8a – Blink ..................................................................................................................... 8-20
Your First Sketch ............................................................................................................. 8-20
Modifying Blink ................................................................................................................ 8-23
Lab 8b – Pushing Your button ............................................................................................ 8-24
Examine the code ........................................................................................................... 8-24
Reverse button/LED action ............................................................................................. 8-25
Lab 8c – Serial Communication (and Debugging) .............................................................. 8-26
What if the Serial Monitor is blank? (’G2553 Launchpad Configuration) ...................... 8-27
Blink with Serial Communication ..................................................................................... 8-28
Another Pushbutton/Serial Example ............................................................................... 8-28
Lab 8d – Using Interrupts .................................................................................................... 8-29
Adding an Interrupt .......................................................................................................... 8-29
Lab 8e – Using TIMER_A ................................................................................................... 8-31
Appendix – Looking ‘Under the Hood’ .................................................................................... 8-32
Where, oh where, is Main ............................................................................................... 8-32
Two ways to change the MSP430 clock source ............................................................. 8-34
Sidebar – initClocks() ...................................................................................................... 8-35
Sidebar Cont’d - Where is F_CPU defined? .................................................................. 8-36
Lab Debrief .............................................................................................................................. 8-37