I've got a Wemos D1 (ESP8266) running my arduino program that is supposed to grab a few bytes out of a picaxe set up in hardware I2C slave mode. Supposedly, I should be able to run a program on my picaxe and write to some registers that can be access on demand via I2C from some other device. The Picaxe pretends to be an eeprom. So far, I can get the data I want 10% of the time. The majority of what I get back is either 0xFF, 0xEE or 0x00. I've tried slowing down and speeding up the I2C bus. I've confirmed every I can (o-scope handy) that the voltages on either side are where they need to be during all phases of the program... I've swapped out everything except the level shifter. The results of 0xFF seem somewhat cyclical. What else could I be doing wrong?
relevant picaxe code:
init:
symbol Local_Digital_Air_Temp = w0 ; confirmed working
hi2csetup i2cslave, %10100000
main:
readtemp12 B.0, Local_Digital_Air_Temp ; confirmed working
put 0,Local_Digital_Air_Temp ; confirmed working
debug ; I've tried with and without this debug and with/without pauses.
goto main ; confirmed working
Relevant Arduino code:
#include <Arduino.h>
#include <Wire.h>
#include <extEEPROM.h>
float h1, t1, d1, s1, s2, s3, a0, a1, a2 ,a3, a4, a5, a6, a7;
String hh1, tt1, dd1, ss1, aa0, aa1, aa2, aa3, aa4, aa5, aa6, aa7, Upload, AHP;
extEEPROM myEEPROM(kbits_2, 1, 1, 0x50);
void setup() {
Wire.begin();
myEEPROM.begin(twiClock100kHz);
}
void loop() {
byte1 = myEEPROM.read(0);
AHP = String(byte1, DEC);
Upload = String("Sensor,Device=Tate01 AirHumidPercent=" + AHP);
Serial.println(Upload);
}
Output looks like this:
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=168
Sensor,Device=Tate01 AirHumidPercent=0
Sensor,Device=Tate01 AirHumidPercent=168
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=0
Sensor,Device=Tate01 AirHumidPercent=168
Sensor,Device=Tate01 AirHumidPercent=0
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=168
Sensor,Device=Tate01 AirHumidPercent=168
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=0
Sensor,Device=Tate01 AirHumidPercent=10
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=0
Sensor,Device=Tate01 AirHumidPercent=168
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=168
Sensor,Device=Tate01 AirHumidPercent=168
Sensor,Device=Tate01 AirHumidPercent=0
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=254
Sensor,Device=Tate01 AirHumidPercent=10
Sensor,Device=Tate01 AirHumidPercent=169
Sensor,Device=Tate01 AirHumidPercent=0
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=253
Sensor,Device=Tate01 AirHumidPercent=254
The instances of 168 and 169 are correct results.