I figured it out. Arduino wants the micropython addresses not Analog or digital. Basically I was addressing the wrong pins. Found out by doing a button test and nothing worked until I used micropython addressing. Ugh
//Trying to read a pressure sensor with Xaio RP2040, amazon pressure sensor with HX710B //MPS20N0040D
//all I get is 0 0 0
//I am using a shift level to lower 5 to 3.3 volts and a buck to power the sensor. I have tried a bunch of //different programs with something error to a stuck value 838683.
After posting this I tried my esp8266 and mega 2560. They both worked without the level shifter at 3.3 volts from processor. Still no luck with rp2040.
#include “HX710.h”
const int DOUT = 2;
const int PD_SCK = 1;
#define SERIAL_PLOTTER
HX710 ps;
void setup() {
Serial.begin( 115200 );
ps.initialize( PD_SCK , DOUT );
}
void loop() {
int32_t v1, v2, v3;
while( !ps.isReady() );
ps.readAndSelectNextData( HX710_OTHER_INPUT_40HZ );
v1 = ps.getLastDifferentialInput();
while( !ps.isReady() );
ps.readAndSelectNextData( HX710_DIFFERENTIAL_INPUT_40HZ );
v2 = ps.getLastOtherInput();
while( !ps.isReady() );
ps.readAndSelectNextData( HX710_DIFFERENTIAL_INPUT_10HZ );
v3 = ps.getLastDifferentialInput();
#ifdef SERIAL_PLOTTER
Serial.print( v1 );
Serial.print( “\t” );
Serial.print( v2 );
Serial.print( “\t” );
Serial.println( v3 );
#else
Serial.print( "differential input (10 Hz): " );
Serial.println( v1 );
Serial.print( "temperature (40 Hz): " );
Serial.println( v2 );
Serial.print( "differential input (40 Hz): " );
Serial.println( v3 );
Serial.println();
#endif
}