I have a small sketch I would like to port to the ESP32, but I can't get it to work.
The Arduino sketch and partially modified ESP32 sketch are here: https://github.com/Account-Git/Arduino-to-ESP32
Please, can anyone help?
Something so simple shouldn't be this difficult.
Porting basic code to ESP32
Re: Porting basic code to ESP32
My glass ball needs a repair.
Please define "can't get it to work".
What did you do?
What did you expect?
What did you get instead?
Please define "can't get it to work".
What did you do?
What did you expect?
What did you get instead?
Re: Porting basic code to ESP32
Sorry, yes I should have made myself more clear.
First, I took my original, working, Arduino sketch (as shown on GitHub).
Then, I changed the pin numbers to match the GPIO pins on the ESP32. I also changed the baud rate for the Serial monitor.
And that's all I did.
I was hoping (expecting) to get the same results as I did with the Arduino.
i.e. When one of the inputs on the 74HC165 goes high the microcontroller receives a 1 on that bit, or a 0 if it goes low.
What I got instead was either one 0 instead of eight bits, or eight 1s, and sometimes just a load of rubbish (2 bits, 4bits, 5bits, etc).
It seems that the SPI setup is way off somewhere, but I am new to ESP32 and don't know how to set it up for this type of application despite it appearing very simple at the outset.
First, I took my original, working, Arduino sketch (as shown on GitHub).
Then, I changed the pin numbers to match the GPIO pins on the ESP32. I also changed the baud rate for the Serial monitor.
And that's all I did.
I was hoping (expecting) to get the same results as I did with the Arduino.
i.e. When one of the inputs on the 74HC165 goes high the microcontroller receives a 1 on that bit, or a 0 if it goes low.
What I got instead was either one 0 instead of eight bits, or eight 1s, and sometimes just a load of rubbish (2 bits, 4bits, 5bits, etc).
It seems that the SPI setup is way off somewhere, but I am new to ESP32 and don't know how to set it up for this type of application despite it appearing very simple at the outset.
-
- Posts: 22
- Joined: Mon Feb 12, 2018 6:50 pm
Re: Porting basic code to ESP32
I have not examined your code, but generally the biggest porting issue from Arduino (UNO, Mega, Nano, Micro) and ESP32 is that AVR 8-bit uC has int defined as 16-bits and int on ESP32 is 32-bit.
Good luck.
Ray
Re: Porting basic code to ESP32
Thanks, Ray
What is the "fix/workaround" for this?
What is the "fix/workaround" for this?
Who is online
Users browsing this forum: Google [Bot] and 65 guests