Basic Examples
BW16 (RTL8720DN) Supported ARDUINO built-in example table
There are many built-in examples in Arduino. In the table below, we list all examples that are compatible with Ameba.
Category |
Name |
Comment |
Remarks |
---|---|---|---|
01. Basics |
Analog ReadSerial |
Connect potentiometer to 3.3V. Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
BareMinimum |
|||
Blink |
Pin LED_BUILTIN sets to LED_G |
Onboard LEDs options LED_R, LED_B, and LED_G. (red, blue, and green) |
|
Digital ReadSerial |
|||
Fade |
Use PWM pins D7(PA25), D8(PA26), D11(PA13), D12(PA12) |
||
Read Analog Voltage |
Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
|
02. Digital |
BlinkWithout Delay |
Pin LED_BUILTIN sets to LED_G |
Onboard LEDs options LED_R, LED_B, and LED_G. |
Button |
Replace “ledPin = 13;” by available digital pins. e.g. “ledPin = LED_BUILTIN;” |
Onboard LEDs options LED_R, LED_B, and LED_G. |
|
Debounce |
Replace “ledPin = 13;” by available digital pins. e.g. “ledPin = LED_BUILTIN;” |
Onboard LEDs options LED_R, LED_B, and LED_G. |
|
Digital InputPullup |
Replace “ledPin = 13;” by available digital pins. e.g. “ledPin = LED_BUILTIN;” |
Onboard LEDs options LED_R, LED_B, and LED_G. |
|
StateChange Detection |
Replace “ledPin = 13;” by available digital pins. e.g. “ledPin = LED_BUILTIN;” |
Onboard LEDs options LED_R, LED_B, and LED_G. |
|
toneMelody |
|||
tone Multiple |
|||
tonePitch Follower |
|||
03. Analog |
Analog InOutSerial |
Replace “analogOutPin = 9;” by a PWM pin (D7(PA25), D8(PA26), D11(PA13) or D12(PA12))). e.g. “analogOutPin = 7;”. Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
AnalogInput |
Replace “ledPin = 13;” by available digital pins. e.g. “ledPin = LED_BUILTIN;”. Use ADC pin A2(PB3). |
Onboard LEDs options LED_R, LED_B, and LED_G. ADC pin reading voltage range 0 to 3.3V. |
|
Analog Write Mega |
Use PWM pins D7(PA25), D8(PA26), D11(PA13), D12(PA12) |
Onboard LEDs with PWM. LED_B(D11), and LED_G(D12). |
|
Calibration |
Connect another LED to pin D13. Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
|
Fading |
Use PWM pins D7(PA25), D8(PA26), D11(PA13), D12(PA12). |
Onboard LEDs with PWM. LED_B(D11), and LED_G(D12). |
|
Smoothing |
Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
|
04. Communication |
ASCIITable |
||
Dimmer |
Onboard LEDs options LED_R, LED_B, and LED_G. |
||
Graph |
Connect potentiometer to 3.3V. Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
|
Midi |
Use Serial1 and pin D4(PB1). |
||
MultiSerial |
Required external USB-to-UART module. |
||
Physical Pixel |
Replace “ledPin = 13;” by available digital pins. e.g. “ledPin = LED_BUILTIN;”. |
Onboard LEDs options LED_R, LED_B, and LED_G. |
|
Read ASCIIString |
Use PWM pins for LED, D7(PA25), D8(PA26), D11(PA13), D12(PA12). |
Onboard LEDs with PWM. LED_B(D11), and LED_G(D12). |
|
SerialEvent |
|||
Serial Passthrough |
Required external USB-to-UART module. |
||
05. Control |
Arrays |
Use pins D6, D7, D8, D9, D10, D11. Modify pin number in your code accordingly |
|
ForLoop Iteration |
Use pins D6, D7, D8, D9, D10, D11. Modify pin number in your code accordingly |
||
IfStatement Conditional |
Replace “ledPin = 13;” by available digital pins. e.g. “ledPin = LED_BUILTIN;”. Use ADC pin A2(PB3). |
Onboard LEDs options LED_R, LED_B, and LED_G. ADC pin reading voltage range 0 to 3.3V. |
|
switchCase |
Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
|
switchCase2 |
Use pins D7, D8, D9, D10, D11. Modify pin number used in your code accordingly. |
||
While Statement Conditional |
Use ADC pin A2(PB3). Replace “indicatorLedPin = 13;” by available digital pins. e.g. “indicatorLedPin = LED_BUILTIN;”. Replace “ledPin = 9;” by a PWM pin D7(PA25), D8(PA26), D11(PA13) or D12(PA12)). e.g. “ledPin = 7;” |
ADC pin reading voltage range 0 to 3.3V. Onboard LEDs options LED_R, LED_B, and LED_G. Onboard LEDs with PWM. LED_B(D11), and LED_G(D12). |
|
06. Display |
barGraph |
Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
07. Strings |
Character Analysis |
||
StringAddition Operator |
|||
StringAppend Operator |
|||
String CaseChanges |
|||
String Characters |
|||
String Comparision Operators |
Use ADC pin A2(PB3). |
ADC pin reading voltage range 0 to 3.3V. |
|
StringIndexOf |
|||
StringLength |
|||
String LengthTrim |
|||
String Replace |
|||
String Starts WithEndsWith |
|||
String Substring |
|||
StringToInt |