Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RadioHeadLite
Diff: main.cpp
- Revision:
- 5:75659bdf6605
- Parent:
- 4:8fbdf64301c5
- Child:
- 6:3174bb53265a
--- a/main.cpp Thu Jun 10 16:26:02 2021 +0000
+++ b/main.cpp Tue Jun 22 16:38:09 2021 +0000
@@ -81,9 +81,10 @@
// store up chars in buffer
if(USB.readable()){
size = USB.available();
- if(USB.receive(inbuf+len,size))
- USB.send(inbuf+len, size);
- len += size;
+ if(USB.receive(inbuf+len,size)){
+ USB.send(inbuf+len, size);
+ len += size;
+ }
}
// Send data if newline is found
@@ -100,11 +101,12 @@
static Thread pcThread( osPriorityNormal, OS_STACK_SIZE / 2, NULL, "pc_thread" );
void writePC(){
uint8_t rxBuf[RH_RF95_MAX_MESSAGE_LEN];
- uint8_t size = sizeof(rxBuf);
+ uint8_t size;
printf("starting PC thread\n");
while(1)
{
if(radio.available()){
+ size = sizeof(rxBuf);
if(radio.recv(rxBuf,&size))
// printf("Got: %s\n", rxBuf);
USB.send(rxBuf, size);
@@ -112,6 +114,10 @@
}
}
}
+void trigger()
+{
+ blueLed = !blueLed;
+}
void setup(void)
{
@@ -132,8 +138,7 @@
setup();
while(1){
- ThisThread::sleep_for(1000);
- blueLed = !blueLed;
+ ThisThread::sleep_for(100);
}
}