Hardwarenahe Programmierung
You are viewing an older revision! See the latest version
ESP32 mbed Application Board
mbed Application Board Application board for ESP32 Node32s
As described in Notes the application board has been designed to enable the maximum number of potential experiments and projects, with the minimum footprint.
Although that there are 2x20 way headers for the mbed for jumper wiring pins off-board, it's a fairly well encapsulated platform.
With the addOn board the ESP32 board NodeMCU32s can be used.
Feature list¶
- 128x32 Graphics LCD
- 5 way joystick
- 2 x Potentiometers
- 3.5mm Audio jack (Analog Out)
- Speaker, PWM connected
- 3 Axis +/1 1.5g Accelerometer
- 3.5mm Audio jack (Analog In)
- 2 x Servo motor headers
- RGB LED, PWM connected
- USB-mini-B Connector
- Temperature sensor
- Socket for for Xbee (Zigbee) or RN-XV (Wifi)
- RJ45 Ethernet Connector
- USB-A Connector
- 1.3mm DC Jack input
128x32 LCD¶
An Arduino ESP32 example program to print text to the LCD
mbedEsp32S_LCD_SPI_HelloWorld.ino
#include <U8g2lib.h> U8G2_ST7565_NHD_C12832_F_4W_HW_SPI u8g2(U8G2_R2, 5, 14, 13); // rotation = 180° = U8G2_R2 // VSPImosi(GPIO23), VSPIclk(GPIO18) char buff[20]; void setup(void) { u8g2.begin(); } void loop(void) { sprintf(buff, "Hello World"); u8g2.setFont(u8g2_font_ncenB08_tr); u8g2.drawStr(0,30,buff); u8g2.sendBuffer(); }
Joystick¶
An example program for the mbed application board that uses the joystick button. LED1,2,3,4 light in sequence with up, down, left, right.
mbedESP32_PinArrays.ino
int ledPins[] = { 19, 17, 16, 4 }; // an array of pin numbers to which LEDs are attached int joyPins[] = { 33, 26, 32, 27 }; // an array of pin numbers to which the JoyStick is attached int pinCount = 4; // the number of pins (i.e. the length of the array) int reading, prev, led; void setup() { for (int thisPin = 0; thisPin < pinCount; thisPin++) { pinMode(ledPins[thisPin], OUTPUT); pinMode(joyPins[thisPin], INPUT_PULLDOWN); digitalWrite(ledPins[thisPin], HIGH); } } void loop() { for (int thisPin = 0; thisPin < pinCount; thisPin++) { reading = digitalRead(joyPins[thisPin]); if(reading == HIGH) { prev = led; led = thisPin; } digitalWrite(ledPins[led], LOW); digitalWrite(ledPins[prev], HIGH); } }
Potentiometers¶
Sends ADC values between 0 and 4095 to serial port, so open Tools->Serial Monitor with 115200 baud:
mbedESP32_ADC_Poti1-2.ino
uint8_t ADC6 = 34; uint8_t ADC7 = 35; uint16_t adcPoti2, adcPoti1; void setup() { Serial.begin(115200); Serial.println("\n DAC\mbed\tPoti1->ADC5(P33)\tPoti2->ADC4(P32)"); } void loop() { adcPoti2 = analogRead(ADC6); adcPoti1 = analogRead(ADC7); Serial.printf("ADC: Poti1=%04d\tPoti2=%4d\n", adcPoti1, adcPoti2); delay(500); }