halukmy
Üye
- Katılım
- 7 Şub 2022
- Mesajlar
- 24
- Puanları
- 1
- Yaş
- 68
Hello everyone, i am using ATT7053CU for get current energy from device, i attachment to device but i tried everything with help of gpt3 always returning null or 0
My spi code is like
AT7053_CS_PIN = PA4
void setup() {
pinMode(AT7053_CS_PIN, OUTPUT);
digitalWrite(AT7053_CS_PIN, HIGH);
SPI_2.setMOSI(PA7);
SPI_2.setMISO(PA6);
SPI_2.setSCLK(PA5);
SPI_2.begin();
SPI_2.setDataMode(SPI_MODE0);
SPI_2.setClockDivider(SPI_CLOCK_DIV4);
SPI_2.setBitOrder(MSBFIRST);
and in loop region
digitalWrite(PA4, LOW);
// Send the byte to be written
byte dataToWrite = 0xAA;
SPI.transfer(dataToWrite);
// Take the slave select pin high to deselect the device
digitalWrite(AT7053_CS_PIN, HIGH);
// Wait a bit before reading
delay(10);
// Take the slave select pin low to select the device
digitalWrite(AT7053_CS_PIN, LOW);
// Read a byte from the device
byte dataRead = SPI.transfer(0x00);
// Take the slave select pin high to deselect the device
digitalWrite(AT7053_CS_PIN, HIGH);
// Print the data read from the device
Serial.print("Data read: ");
Serial.println(AT7053_CS_PIN, HEX);
String xy = String(dataRead,HEX);
kodumuz bu şekilde ama bir türlü cs pininden veri çekemiyoruz
fikri olan?