Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
3 years ago. This question has been closed. Reason: Duplicate question
Struggling to convert Arduino code to Mbed
So Im making a project that detects movement via a PIR motion detector, and then posts the word "MOVEMENT" over the serial connection I set up with the mbed to my computer. I have a separate python program running that detects the "MOVEMENT" message and sends an email to me letting me know that movement has been detected.
I've tested the serial connection using a hello world program and I did the same with the PIR sensor.
Im pretty much a noob at all of this, and it seems pretty simple so Im pretty sure someone on this forum should be able to help me haha.
Ive included a picture of the Arduino code, I just need to convert it to work on Mbed.
My "what-do" diagram was pretty much
-set up serial connection -let pir sensor take snapshot for 2 seconds -if movement detected print movement -if movement detected, and it hasnt been 60 seconds since the last movement message then post "too soon"
The delay is to stop it from spamming my phone with emails. Below is the Arduino code