Temperature = (sensorValue3 * 100.0) / 1023 įor the future please post your code between tags so your code looks like this and is easy to copy to a text editor #define LCD_CS A3 // Chip Select A3 Input_current = (sensorValue2 / 1024.0) * 5000 // Gets you mVĪmps = ((input_current - ACSoffset) / mVperAmp) Tft.setRotation(3) // Need for the Mega, please changed for your choice or rotation initialīattery_voltage = (sensorValue1 / 1024.0) * 5.0 Īctual_batt_volt = (battery_voltage * (R1+R2)) / R2 Īctual_batt_volt = actual_batt_volt - offset_voltage Int sensorValue3 = 0 // value read from the pot3 Int sensorValue2 = 0 // value read from the pot2 Int sensorValue1 = 0 // value read from the pot1 a simpler declaration can optionally be used:Īdafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET) Ĭonst int analogInPin0 = A11 // Analog input pin that the potentiometer1 is attached toĬonst int analogInPin2 = A13 // Analog input pin that the potentiometer2 is attached toĬonst int analogInPin4 = A15 // Analog input pin that the potentiometer3 is attached to If using the shield, all control and data lines are fixed, and Assign human-readable names to some common 16-bit color values: #define LCD_RD A0 // LCD Read goes to Analog 0 #define LCD_CD A2 // Command/Data Register Select A2 Pls read it and tell how to avoid voltage variations and how to implement in coding. You could write some code that only prints a new value if it differs from the previous value by X It is not unusal to get small variations in readings from an ADC. First, please post your program so we have some idea what the problem is.
0 Comments
Leave a Reply. |