Download libraries/Bridge/examples/MailboxReadMessage/MailboxReadMessage.ino from Beifengdo/Arduino-Development: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/datasets/Beifengdo/Arduino-Development/resolve/main/libraries/Bridge/examples/MailboxReadMessage/MailboxReadMessage.ino
- Command line
-
hf download hf://datasets/Beifengdo/Arduino-Development/libraries/Bridge/examples/MailboxReadMessage/MailboxReadMessage.ino
-
curl -L -o MailboxReadMessage.ino https://huggingface.co/datasets/Beifengdo/Arduino-Development/resolve/main/libraries/Bridge/examples/MailboxReadMessage/MailboxReadMessage.ino
1.34 kB
| /* | |
| Read Messages from the Mailbox | |
| This example for the YunShield/Yún shows how to | |
| read the messages queue, called Mailbox, using the | |
| Bridge library. | |
| The messages can be sent to the queue through REST calls. | |
| Appen the message in the URL after the keyword "/mailbox". | |
| Example | |
| "/mailbox/hello" | |
| created 3 Feb 2014 | |
| by Federico Vanzati & Federico Fissore | |
| This example code is in the public domain. | |
| http://www.arduino.cc/en/Tutorial/MailboxReadMessage | |
| */ | |
| void setup() { | |
| pinMode(13, OUTPUT); | |
| digitalWrite(13, LOW); | |
| // Initialize Bridge and Mailbox | |
| Bridge.begin(); | |
| Mailbox.begin(); | |
| digitalWrite(13, HIGH); | |
| // Initialize Serial | |
| SerialUSB.begin(9600); | |
| // Wait until a Serial Monitor is connected. | |
| while (!SerialUSB); | |
| SerialUSB.println("Mailbox Read Message\n"); | |
| SerialUSB.println("The Mailbox is checked every 10 seconds. The incoming messages will be shown below.\n"); | |
| } | |
| void loop() { | |
| String message; | |
| // if there is a message in the Mailbox | |
| if (Mailbox.messageAvailable()) { | |
| // read all the messages present in the queue | |
| while (Mailbox.messageAvailable()) { | |
| Mailbox.readMessage(message); | |
| SerialUSB.println(message); | |
| } | |
| SerialUSB.println("Waiting 10 seconds before checking the Mailbox again"); | |
| } | |
| // wait 10 seconds | |
| delay(10000); | |
| } | |