This means that when you place your finger in the aluminium pad, the LED lights up. This code reads the touch value from the pin we’ve defined, and lights up an LED when the value is below the threshold. check if the touchValue is below the threshold read the state of the pushbutton value: variable for storing the touch pin value Touch the wire connected to GPIO 4 and you’ll see the values decreasing.Ĭopy the following code to your Arduino IDE. You’ll see the new values being displayed every second. In the Arduino IDE window, go to Tools and open the Serial Monitor at a baud rate of 115200. You will touch the metal part of this wire so that it senses the touch. Testing the sketch exampleĬonnect a jumper wire to GPIO 4. Make sure you have the right board and COM port selected. Now, upload the code to your ESP32 board. You can either pass the touch sensor number (T0) or the GPIO number (4). In this case, the example uses T0, which is the touch sensor 0, in GPIO 4. Use the touchRead() function, and pass as an argument the pin you want to read. In the loop() is where you read the sensor. In this code, in the setup(), you start by initializing the Serial Monitor to display the sensor readings. The T0 pin (touch pin 0), corresponds to GPIO 4, as we’ve seen previously in the pinout. This example reads the touch pin 0 and displays the results in the Serial Monitor. Serial.println(touchRead(4)) // get value of Touch 0 pin = GPIO 4 Just test touch pin - Touch0 is T0 which is on GPIO 4.ĭelay(1000) // give me time to bring up serial monitor In the Arduino IDE, go to File > Examples > ESP32 > Touch and open the TouchRead sketch. Let’s see how that function works by using an example from the library. Mac and Linux instructions – ESP32 Board in Arduino IDE.Windows instructions – ESP32 Board in Arduino IDE.We’ll program the ESP32 using Arduino IDE, so make sure you have the ESP32 add-on installed before proceeding: touchRead(GPIO) Code – Reading the Touch Sensor In the Arduino IDE, you use the touchRead() function, that accepts as argument, the GPIO you want to read. Reading the touch sensor is straightforward. If you don’t have this issue, please ignore this note. If you want to refer to GPIO33 you should use T9. This means that if you want to refer to GPIO 32 you should use T8 in the code. GPIO 33 is swapped with GPIO 32 in the assignment. Note: at the time of writing this tutorial, there is an issue with touch pin assignment in Arduino IDE. GPIO 0 is available on the version with 36 pins. However, it’s not available as a pin in this particular ESP32 development board (version with 30 GPIOs). You can see that touch sensor 0 corresponds to GPIO 4, touch sensor 2 to GPIO 2, and so on. It is also sold separately as an add-on with code E42.Learn more about the ESP32 GPIOs: ESP32 Pinout Reference. It can be charged via the USB port of the controller and is included in the E40.1B version. * The Rechargeable battery module can replace the 6xAA batteries. This feature is ideal for science experiments using records of the values of the sensors While recording these readings, individual graphs for each sensor are created. This is accomplished by recording sensor readings and exporting them into a file for further analysis. STEM and Robotics Theoretical backgroundĭownload KEIRO™ from Play Store or App StoreĪ unique feature of Produino is the ability for Data Acquisition.Onboard breadboard for applying electronic circuits.Arduino platform embedded, Display 128圆4.Produino controller with 7 input-output ports.406 Plastic parts, 1914 Connecting points.Plastic tub (43 x 31 x 15 cm) with internal dividers.It allows the construction of more than 30 STEM and Robotic models. Besides the programmable screen, it conveniently has a built-in large breadboard so that students can make their own circuitry. It has 2 DC motors, a servo motor, a touch sensor, 2 IR sensors, a color sensor, an ultrasonic sensor and a gyroscope/accelerometer sensor. The set comes in a convenient plastic storage tub that contains a large number of Engino structural and technical parts and high-level of robotic devices such as the unique Produino controller. Besides its main controller, it embeds an additional Arduino processor that enables open DIY projects. With innovative experimental activities that cover the core subjects of STEM it moves into advanced programming with textual coding. The STEM & Robotics Produino education set is specially designed for Secondary school children of ages 12-16+ but is ideal for older students of 14+ and even vocational schools and hobby engineers.
0 Comments
Leave a Reply. |