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.
Revision 1:bf50812995c6, committed 2015-10-23
- Comitter:
- pmckenna
- Date:
- Fri Oct 23 16:39:06 2015 +0000
- Parent:
- 0:015c04037667
- Commit message:
- updated to show S2M message also
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 23 15:32:21 2015 +0000
+++ b/main.cpp Fri Oct 23 16:39:06 2015 +0000
@@ -26,6 +26,16 @@
{0x7F, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00} // Data BroadCast + LEDs OFF + USE NAD
};
+LinMaster::Frame_t S2MFrame =
+{
+ LinMaster::S2M, // Direction
+ LinMaster::Enhanced, // CRC Type
+ LinMaster::Normal, // Break Type
+ 8, // Data Length
+ 0x05, // Frame ID
+ {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} // Data BroadCast + LEDs OFF + USE NAD
+};
+
void SetLED(int Address, int OnOff, int R, int G, int B, int I, int FadingTime, int FadingOnOff);
void SetIntensity(int arg);
void SetLEDsOnOff(int arg);
@@ -48,7 +58,11 @@
for(;;)
{
SetLED(FIRSTNAD + (rand()%NUMBEROFNODES), 1, rand()%255, rand()%255, rand()%255, rand()%100, 1, 1); //set random node to random color and intensity
- wait_ms(40);
+ wait_ms(40); //delay 40ms
+ LinMaster.send_frame(&S2MFrame); //Send S2M message to get VS voltage form nodes
+ while(LinMaster.status() != LinMaster::IDLE); //wait for bus to become idle before rtreiving data from slvae
+ LinMaster.get_rx_data(S2MFrame); //move data form slave into data bytes of S2MFrame
+ wait_ms(40); //delay 40ms
}
}
@@ -63,8 +77,8 @@
M2SFrame.Data[6] = G;
M2SFrame.Data[7] = B;
- (void)LinMaster.send_frame(&M2SFrame);
- while(LinMaster.status() != LinMaster::IDLE);
+ LinMaster.send_frame(&M2SFrame);
+ //while(LinMaster.status() != LinMaster::IDLE);
}
void SetLEDsOnOff(int arg)