mackorone / mms

A Micromouse simulator: write and test maze-solving code without a physical robot
MIT License
395 stars 83 forks source link

Running error on ESP32 #26

Closed Blaze-Leo closed 1 year ago

Blaze-Leo commented 1 year ago

I know that the arduino version must work as long it is an ATmega. But somehow it doesnot work on the ESP32even though it works on my Arduino Mega. The ESP32works correctly, but all the simulator shows is RUNNING. What am I doing wrong?

mackorone commented 1 year ago

Hmm... I'm unfamiliar with the ESP32 system. If it's not working with the code in the mackorone/mms-arduino repository, you may need to develop you're own code for using it with the simulator. My advice would be to play around with sending and receiving data from the board before trying to integrate it with the simulator. For example, can you run your "main" program and manually communicate with the process running on the board via stdin/stdout? If so, great! If not, that's the first thing to debug.

Since this issue isn't debuggable by me (I don't own an ESP32 board) I'm going to close this issue for now. Feel free to reopen if you think something about the simulator needs to be fixed, or if you write your own library and would like me to include a link to in within the repo's README.md.

Blaze-Leo commented 1 year ago

The thing is that its working but not every time. When I use the Arduino, suppose if i upload the code today and run it tomorrow, it runs just fine. But, for the ESP32 if I upload it right now, and try to make it work it just runs sometimes, and once it has worked once, it just doesn't connect with the computer again.

kthompson4344 commented 1 year ago

The Arduino code in mackorone/mms-arduino assumes that when a serial connection from the simulator is established the Arduino will reset (which is the behavior of most Arduino compatible boards). I have a Seeeduino XIAO that I tested that does not reset upon opening a serial connection and it behaves as you described where it will work once but then will not work further. So a few questions that may help narrow down the issue:

  1. What ESP32 board are you using?
  2. If you reboot or reset manually each time then run it from the simulator does it work?
  3. Does adding while (!Serial); after line 2 of mms-arduino.ino help?
Blaze-Leo commented 1 year ago

I am using a Dev-Kit -V1 and later on I plan to use a Esp-Pico-D4. If I reboot or reset manually it does not work. I will try the while loop and return back. Thanks, @kthompson4344 The while loop works, just uploaded the code, and then if it doesn't work pressing the reset button restarts the process and the ESP reconnects. And there seems to be another additional requirement, immediately after the while(Serial); you have to display something like log("Running");. This Running won't be displayed in the screen but without this ESP won't connect.