03-02 FlashingLEDspleLED
From Manuals
(Difference between revisions)
| (10 intermediate revisions not shown) | |||
| Line 1: | Line 1: | ||
| - | + | This example alternately flashes LEDs connected to pins D0 and D1 on connector J9 of the BAM210. | |
| + | The signals used for this example are listed below: | ||
| + | {| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;" | ||
| + | |+ align="bottom"|'''Signals Used and Connector Locations for Example 03-03''' | ||
| + | |'''Signal''' | ||
| + | |'''LPC4330 PIN NAME''' | ||
| + | |'''BAM210E''' | ||
| + | |'''BAM210''' | ||
| + | |'''BAM200E''' | ||
| + | |'''BAM200''' | ||
| + | |'''Used for''' | ||
| + | |- | ||
| + | |D0 | ||
| + | |P6_5 | ||
| + | |J9-1 | ||
| + | |J9-1 | ||
| + | |S2-5 | ||
| + | |S2-5 | ||
| + | |Red LED | ||
| + | |- | ||
| + | |D1 | ||
| + | |P6_4 | ||
| + | |J9-2 | ||
| + | |J9-2 | ||
| + | |S2-4 | ||
| + | |S2-4 | ||
| + | |Green LED | ||
| + | |- | ||
| + | |} | ||
| + | |||
| + | The following schematic can be used to build the circuit with a BAM210E or BAM210. | ||
[[Image:BAM210_03_02_SCH.png|center|alt=BAM210|frame|<div align="center">'''Schematic for example 03-02''']] | [[Image:BAM210_03_02_SCH.png|center|alt=BAM210|frame|<div align="center">'''Schematic for example 03-02''']] | ||
| - | |||
| - | |||
<div style="text-align: left;"> | <div style="text-align: left;"> | ||
| Line 13: | Line 41: | ||
DigitalOut greenled(D1); //define and name a digital output on pin D1 | DigitalOut greenled(D1); //define and name a digital output on pin D1 | ||
| - | + | /*Program Example 3.2: Flashes red and green LEDs in simple time-based pattern | |
| - | + | */ | |
| - | + | #include "mbed.h" | |
| - | + | DigitalOut redled(D0); //define and name a digital output on pin D0 | |
| - | + | DigitalOut greenled(D1); //define and name a digital output on pin D1 | |
| - | + | ||
| - | + | int main() | |
| - | + | { | |
| - | + | while(1) { | |
| - | + | redled = 1; | |
| - | + | greenled = 0; | |
| - | + | wait(0.2); | |
| - | + | redled = 0; | |
| - | + | greenled = 1; | |
| - | + | wait(0.2); | |
| - | + | } | |
} | } | ||
| + | |||
| + | The following image shows the built circuit on a BAM210E. | ||
| + | [[Image:BAM210_flashLED.jpeg|center|]] | ||
Current revision as of 18:03, 17 September 2014
This example alternately flashes LEDs connected to pins D0 and D1 on connector J9 of the BAM210.
The signals used for this example are listed below:
| Signal | LPC4330 PIN NAME | BAM210E | BAM210 | BAM200E | BAM200 | Used for |
| D0 | P6_5 | J9-1 | J9-1 | S2-5 | S2-5 | Red LED |
| D1 | P6_4 | J9-2 | J9-2 | S2-4 | S2-4 | Green LED |
The following schematic can be used to build the circuit with a BAM210E or BAM210.
/*Program Example 3.2: Flashes red and green LEDs in simple time-based pattern
*/
#include "mbed.h"
DigitalOut redled(D0); //define and name a digital output on pin D0
DigitalOut greenled(D1); //define and name a digital output on pin D1
/*Program Example 3.2: Flashes red and green LEDs in simple time-based pattern
*/
#include "mbed.h"
DigitalOut redled(D0); //define and name a digital output on pin D0
DigitalOut greenled(D1); //define and name a digital output on pin D1
int main()
{
while(1) {
redled = 1;
greenled = 0;
wait(0.2);
redled = 0;
greenled = 1;
wait(0.2);
}
}
The following image shows the built circuit on a BAM210E.


