Maple Lesson 01 - Blinking LED
Language | English |
---|
ObjectiveUse the Microduino-CoreSTM32 to control a LED light, and use the Maple IDE to program for the Microduino-CoreSTM32, just like programming in the Arduino IDE. EquipmentMicroduino-CoreSTM32 is an ARM development board using STM32F103CBT6 chip. It use special Upin7 interface, the size is similar with a coin and fully compatible other Microduino modules.
Experiment schematic
This experiment will use the first method, you can try another method. Programint led = 13; //Define the LED control pin
void setup() {
pinMode(led, OUTPUT); //Define the pin as output
}
void loop() {
digitalWrite(led, HIGH); //Output higt voltage
delay(1000); // Delay 1s
digitalWrite(led, LOW); //Output low voltage
delay(1000); // Delay 1s
}
Let's analyze the program:
Note: 0 ~ 13 mapping to D0 ~ D13 and 14 ~ 21 mapping to A0 ~ A7 on board. For example, if you want to use A0 to control the LED, need change the “int led = 13;” to “int led = 14;”
int led=13;
void setup() {
// Set up the built-in LED pin as an output:
pinMode(led, OUTPUT);
}
void loop() {
togglePin(led); // Turn the LED from off to on, or on to off
delay(1000); // Wait for 1 second (1000 milliseconds)
}
Grammatical information: togglePin(led):Swith the specific pin's output value. If the pin is high voltage, then set it to low voltage, otherwise set it to high. Debug
|