Because each platform could have unique pins or header layouts, we
show
Blink
on multiple platforms in the following sections.
2.1 Blink on Arduino
Many Arduino boards have a single LED right on the board, tied to pin
13
.
If you have such a board, then before
going to the trouble of wiring up a breadboard with multiple LEDs, just
build the Arduino Blink example without modification and try it on your board. This is a
good starting point.
If you want to see multiple LEDs blinking using an Arduino, then using a separate
breadboard is the best way. The Arduino is a breeze to wire up because the pin assignments are
printed on the Arduino circuit board and those are the numbers
used to address them in the code. Not all boards are this straightforward.
Figure 1. Arduino Wiring Diagram
This is the main program for the Arduino.
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
//
|
[GPLv2] |
|
// OOSMOS Blink Example
|
|
//
|
|
// Copyright (C) 2014-2020 OOSMOS, LLC
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 2 of the License ("GPLv2").
|
|
//
|
|
// This software may be used without the GPLv2 restrictions by entering
|
|
// into a commercial license agreement with OOSMOS, LLC.
|
|
// See <https://www.oosmos.com/licensing/>.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
|
|
#include "oosmos.h"
|
#includes... |
|
#include "pin.h"
|
|
#include "toggle.h"
|
|
|
|
static void SetupToggle(int Pin, int OnTimeMS, int OffTimeMS)
|
|
{
|
|
pin * pPin = pinNew(Pin, pinOut, pinActiveHigh);
|
|
toggleNew(pPin, OnTimeMS, OffTimeMS);
|
|
}
|
|
|
|
extern void setup()
|
|
{
|
|
SetupToggle(13, 50, 500);
|
|
SetupToggle(12, 2000, 2000);
|
|
SetupToggle(11, 50, 1500);
|
|
}
|
|
|
|
extern void loop()
|
|
{
|
|
oosmos_RunStateMachines();
|
|
}
|
|
BlinkExample.ino - Blink for Arduino
2.2 Blink on ESP8266
The ESP8266 ESP-01 is an exciting board. It's very inexpensive, has a full-fledged
80 MHz processor, about 45K of user available RAM, and it has WI-FI capability
so it's ideal for connecting devices to the Internet.
We hope to use this processor more and more for
OOSMOS
-based IOT projects.
Notes:
When uploading from the Arduino IDE to the ESP8266:
- The
RST
pin of the ESP8266 is connected to the DTR
pin of the USB-to-UART
module (see figure
2). This is called auto-reset; you need
only press the PROG
button to upload new code.
- You must press and hold the
PROG
button during upload.
You can wait until you see the Uploading
message
before pressing it. Leave it pressed until you see the
Done
uploading
message. When
you release the button, the board should immediately run your code.
- Make sure the serial monitor window is closed. If you leave it open,
the board can be programmed but the ESP8266 will not reset properly
when it's done uploading.
Figure 2. ESP8266 Wiring Diagram
This is the main program for Blink on ESP8266. Because there is only
one LED on board, we blink that.
Note that because the
ESP8266
has sleep capability, we
demonstrate it here. (See lines
49-50.)
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
//
|
[GPLv2] |
|
// OOSMOS - The Object-Oriented State Machine Operating System
|
|
//
|
|
// Copyright (C) 2014-2020 OOSMOS, LLC
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 2 of the License ("GPLv2").
|
|
//
|
|
// This software may be used without the GPLv2 restrictions by entering
|
|
// into a commercial license agreement with OOSMOS, LLC.
|
|
// See <https://www.oosmos.com/licensing/>.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
|
|
#include "oosmos.h"
|
#includes... |
|
#include "pin.h"
|
|
#include "toggle.h"
|
|
|
|
//
|
|
// It is unclear which #include file holds these prototypes. We declare
|
|
// them here for now.
|
|
//
|
|
extern "C" bool system_deep_sleep_set_option(int option);
|
|
extern "C" void system_deep_sleep(int);
|
|
|
|
static void SetupToggle(int Pin, int OnTimeMS, int OffTimeMS)
|
|
{
|
|
pin * pPin = pinNew(Pin, pinOut, pinActiveLow);
|
|
toggleNew(pPin, OnTimeMS, OffTimeMS);
|
|
}
|
|
|
|
extern void setup()
|
|
{
|
|
SetupToggle(LED_BUILTIN, 100, 2000);
|
|
}
|
|
|
|
extern void loop()
|
|
{
|
|
oosmos_RunStateMachines();
|
|
|
|
//system_deep_sleep_set_option(4);
|
|
//system_deep_sleep(10*1000); // in uS...
|
|
}
|
|
BlinkExample.ino - Blink for ESP8266
2.3 Blink on MSP430
The Fritzing tool does not have the
MSP430F5529
LaunchPad part that we have, so we created
custom female header parts, labeled as they are on the
MSP430F5529
, in
order to guide you graphically through the wiring process.
Figure 3. MSP430 Wiring Diagram
The
MSP430
board has specialized pin addressing.
(See lines
29-31.)
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
//
|
[GPLv2] |
|
// OOSMOS - The Object-Oriented State Machine Operating System
|
|
//
|
|
// Copyright (C) 2014-2020 OOSMOS, LLC
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 2 of the License ("GPLv2").
|
|
//
|
|
// This software may be used without the GPLv2 restrictions by entering
|
|
// into a commercial license agreement with OOSMOS, LLC.
|
|
// See <https://www.oosmos.com/licensing/>.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "oosmos.h"
|
#includes... |
|
#include "pin.h"
|
|
#include "toggle.h"
|
|
|
|
extern void setup()
|
|
{
|
|
pin * pLedSlow = pinNew(P1_2, pinOut, pinActiveHigh);
|
|
pin * pLedFast = pinNew(P1_3, pinOut, pinActiveHigh);
|
|
pin * pLedPing = pinNew(P1_4, pinOut, pinActiveHigh);
|
|
|
|
toggleNew(pLedSlow, 2000, 2000);
|
|
toggleNew(pLedFast, 100, 100);
|
|
toggleNew(pLedPing, 50, 1500);
|
|
}
|
|
|
|
extern void loop()
|
|
{
|
|
oosmos_RunStateMachines();
|
|
}
|
|
BlinkExample.ino - Blink for MSP430
2.4 Blink on PIC32 Starter Kit
We demonstrate two boards that use the
PIC32
processor:
the
PIC32
Starter
Kit
directly from Microchip, and the Arduino-compatible
ChipKit board. This example uses the
PIC32
Starter
Kit
. Because
there are already three
LED
s on the board that we can
address, we don't need to use
the I/O Expansion board, so there is no external wiring required.
Figure 4. PIC32 Starter Kit Board
Using the PIC32 environment from MPLAB, we need to specify certain
#pragma
s
to configure the chip. (See lines
27-28.)
Additionally, the PIC32 that uses PLIB from Microchip has specialized pin addressing.
(See lines
34-36.)
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
//
|
[GPLv2] |
|
// OOSMOS - PIC32 Blink main program
|
|
//
|
|
// Copyright (C) 2014-2020 OOSMOS, LLC
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 2 of the License ("GPLv2").
|
|
//
|
|
// This software may be used without the GPLv2 restrictions by entering
|
|
// into a commercial license agreement with OOSMOS, LLC.
|
|
// See <https://www.oosmos.com/licensing/>.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
|
|
#include "oosmos.h"
|
#includes ... |
|
#include "toggle.h"
|
|
#include "pin.h"
|
|
|
|
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
|
#pragmas ... |
|
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_1
|
|
|
|
extern int main(void)
|
|
{
|
|
oosmos_ClockSpeedInMHz(80);
|
|
|
|
pin * pRED = pinNew(IOPORT_D, BIT_0, pinOut, pinActiveHigh);
|
|
pin * pYELLOW = pinNew(IOPORT_D, BIT_1, pinOut, pinActiveHigh);
|
|
pin * pGREEN = pinNew(IOPORT_D, BIT_2, pinOut, pinActiveHigh);
|
|
|
|
toggleNew(pRED, 2000, 2000);
|
|
toggleNew(pYELLOW, 100, 100);
|
|
toggleNew(pGREEN, 50, 1500);
|
|
|
|
for (;;) {
|
|
oosmos_RunStateMachines();
|
|
}
|
|
}
|
|
2.5 Blink on ChipKit
Unlike an Arduino Uno,
the ChipKit has two rows of headers, so be careful while wiring.
Figure 5. Blink on ChipKit
Because the
ChipKit
is Arduino pin compatible, we can use the exact
same main program as we did for the Arduino example.
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
//
|
[GPLv2] |
|
// OOSMOS Blink Example
|
|
//
|
|
// Copyright (C) 2014-2020 OOSMOS, LLC
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 2 of the License ("GPLv2").
|
|
//
|
|
// This software may be used without the GPLv2 restrictions by entering
|
|
// into a commercial license agreement with OOSMOS, LLC.
|
|
// See <https://www.oosmos.com/licensing/>.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
|
|
#include "oosmos.h"
|
#includes... |
|
#include "pin.h"
|
|
#include "toggle.h"
|
|
|
|
static void SetupToggle(int Pin, int OnTimeMS, int OffTimeMS)
|
|
{
|
|
pin * pPin = pinNew(Pin, pinOut, pinActiveHigh);
|
|
toggleNew(pPin, OnTimeMS, OffTimeMS);
|
|
}
|
|
|
|
extern void setup()
|
|
{
|
|
SetupToggle(13, 50, 500);
|
|
SetupToggle(12, 2000, 2000);
|
|
SetupToggle(11, 50, 1500);
|
|
}
|
|
|
|
extern void loop()
|
|
{
|
|
oosmos_RunStateMachines();
|
|
}
|
|
BlinkExample.ino - Blink for ChipKit
2.6 Blink on mbed
This example has been tested using
mbed.com
's web-based
developer program workspace targeting the
LPC1768
and
FRDM-K64F
boards.
We show the
LPC1768
board here.
Because the
mbed LPC1768
board has four onboard
LED
s, we use them all.
Plug your
mbed
device into your computer via USB. A new drive letter will appear.
Let's say it comes up as the
G:
drive.
Upload the
mbed
blink project files to
mbed.com
's online workspace and select "compile", which
will initiate a download of the resulting
bin
file. Drag that file to the
volume of the device, e.g. the
G:
drive, and then press the reset button on the
device. The four
LED
s on the board should now blink at the rates specified in the main
program.
Figure 6. MBED Board
The
mbed
board has specialized pin addressing.
(See lines
29-32.)
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
//
|
[GPLv2] |
|
// OOSMOS - mbed Blink example main program.
|
|
//
|
|
// Copyright (C) 2014-2020 OOSMOS, LLC
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 2 of the License ("GPLv2").
|
|
//
|
|
// This software may be used without the GPLv2 restrictions by entering
|
|
// into a commercial license agreement with OOSMOS, LLC.
|
|
// See <https://www.oosmos.com/licensing/>.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
|
|
#include "oosmos.h"
|
|
#include "pin.h"
|
|
#include "toggle.h"
|
|
|
|
extern int main(void)
|
|
{
|
|
pin * pLED1 = pinNew(LED1, pinOut, pinActiveHigh);
|
|
pin * pLED2 = pinNew(LED2, pinOut, pinActiveHigh);
|
|
pin * pLED3 = pinNew(LED3, pinOut, pinActiveHigh);
|
|
pin * pLED4 = pinNew(LED4, pinOut, pinActiveHigh);
|
|
|
|
toggleNew(pLED1, 5000, 2000);
|
|
toggleNew(pLED2, 100, 100);
|
|
toggleNew(pLED3, 500, 500);
|
|
toggleNew(pLED4, 50, 1500);
|
|
|
|
for (;;) {
|
|
oosmos_RunStateMachines();
|
|
}
|
|
}
|
|
|
|
main.cpp - Blink for mbed
2.7 Blink on LightBlue Bean
LightBlue Bean is essentially an Arduino with BlueTooth Low Energy (BLE)
capability built in.
The pin assignments are different than on an Arduino, so this is a slightly
specialized main program. See the example in Snippet 1,
below.
Note that the photo shows a set of female headers soldered onto the board. The board does not come
with these; we added them.
Because in this example we
are going to drive three (approximately) 20 mA LEDs, we cannot use the low-current 3V coin
battery (approximately 15 mA total maximum), so we borrow power from the regulated 3.3V power supply of a separate USB-powered Arduino.
Figure 7. LightBlue Bean Board
The
LightBlue
Bean
board has specialized pin addressing.
(See lines
29-31.)
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
//
|
[GPLv2] |
|
// OOSMOS Blink Example
|
|
//
|
|
// Copyright (C) 2014-2020 OOSMOS, LLC
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 2 of the License ("GPLv2").
|
|
//
|
|
// This software may be used without the GPLv2 restrictions by entering
|
|
// into a commercial license agreement with OOSMOS, LLC.
|
|
// See <https://www.oosmos.com/licensing/>.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
|
|
#include "oosmos.h"
|
#includes... |
|
#include "pin.h"
|
|
#include "toggle.h"
|
|
|
|
extern void setup()
|
|
{
|
|
pin * pLedSlow = pinNew(1, pinOut, pinActiveHigh);
|
|
pin * pLedFast = pinNew(2, pinOut, pinActiveHigh);
|
|
pin * pLedPing = pinNew(3, pinOut, pinActiveHigh);
|
|
|
|
toggleNew(pLedSlow, 2000, 2000);
|
|
toggleNew(pLedFast, 100, 100);
|
|
toggleNew(pLedPing, 50, 1500);
|
|
}
|
|
|
|
extern void loop()
|
|
{
|
|
oosmos_RunStateMachines();
|
|
}
|
|
Snippet 1. BlinkExample.ino - Blink for LightBlue Bean
2.8 Blink on Raspberry Pi
For Raspberry Pi, we use the
Wiring Pi library,
which gives us a familiar single number pin description just like Arduino. Wiring Pi
is not part of our distribution, so you'll have to download and build it yourself.
For
Wiring
Pi
pin numbers for the various Raspberry Pi models,
go here.
Figure 8. Raspberry Pi Wiring Diagram
This is the main program for the Raspberry Pi. Note the specialized pin
addressing on lines
29-31.
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
//
|
[GPLv2] |
|
// OOSMOS - Blink main program for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2014-2020 OOSMOS, LLC
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 2 of the License ("GPLv2").
|
|
//
|
|
// This software may be used without the GPLv2 restrictions by entering
|
|
// into a commercial license agreement with OOSMOS, LLC.
|
|
// See <https://www.oosmos.com/licensing/>.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
|
|
#include "oosmos.h"
|
#includes ... |
|
#include "toggle.h"
|
|
#include "pin.h"
|
|
|
|
extern int main(void)
|
|
{
|
|
pin * pRED = pinNew(0, pinOut, pinActiveHigh);
|
|
pin * pYELLOW = pinNew(2, pinOut, pinActiveHigh);
|
|
pin * pGREEN = pinNew(3, pinOut, pinActiveHigh);
|
|
|
|
toggleNew(pRED, 2000, 2000);
|
|
toggleNew(pYELLOW, 100, 100);
|
|
toggleNew(pGREEN, 50, 1500);
|
|
|
|
for (;;) {
|
|
oosmos_RunStateMachines();
|
|
oosmos_DelayMS(1);
|
|
}
|
|
}
|
|
main.c - Blink for Raspberry Pi
2.9 Blink on Trinket Pro
The
Blink
code for the Trinket Pro is identical to the code
for the Blink for Arduino application.