![]() The code does not work in the Arduino Uno Wifi: it does not show any change in the bend degrees. Serial.println("Bend: " + String(angle) + " degrees") Use the calculated resistance to estimate the sensor'sįloat angle = map(flexR, STRAIGHT_RESISTANCE, BEND_RESISTANCE, 0, 90.0) Serial.println("Resistance: " + String(flexR) + " ohms") ![]() ![]() Read the ADC, and calculate voltage and resistance from itįloat flexR = R_DIV * (VCC / flexV - 1.0) Upload the code, then try to adjust these values to moreĬonst float STRAIGHT_RESISTANCE = 37300.0 // resistance when straightĬonst float BEND_RESISTANCE = 90000.0 // resistance at 90 deg Measure the voltage at 5V and the actual resistance of yourĬonst float VCC = 4.98 // Measured voltage of Ardunio 5V lineĬonst float R_DIV = 47500.0 // Measured resistance of 3.3k resistor I am using the code below (copy paste from the official website) const int FLEX_PIN = A4 // Pin connected to voltage divider output I recently got an Arduino Uno Wifi (flashed it with the Wifilink firmware to support UDP) and I have created a simple sketch to read analog values from a flex sensor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |