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 0:47259286a496, committed 2019-09-24
- Comitter:
- tamamfirdaus
- Date:
- Tue Sep 24 14:15:29 2019 +0000
- Commit message:
- Slave
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Sep 24 14:15:29 2019 +0000
@@ -0,0 +1,36 @@
+//Ini Kodingan untuk mengirim data int signed (int32_t) antar nukleo
+//Slave yg ngirim data
+//bisa error kalo pencet tombolnya kecepetan datanya jadi beda
+#include "mbed.h"
+
+Serial slave(PC_10, PC_11);
+DigitalIn BlueButton(USER_BUTTON); // This is Blue-Button and is on NUCLEO-L153RE
+
+#define Pressed 0
+#define NotPressed 1
+int32_t numberToSend; //data yang dikirim
+double a = 2137.32422;
+uint8_t A,B,C,D; //variabel untuk convert int ke char
+uint32_t temp; //temporary int yg dishift
+
+int main(){
+ while(1){
+ if (BlueButton == Pressed){
+ numberToSend = (int32_t) 2245.24556;//(a*1000);
+ temp = numberToSend>>24;
+ A = (uint8_t) temp;
+ temp = (numberToSend<<8)>>24;
+ B = (uint8_t) temp;
+ temp = (numberToSend<<16)>>24;
+ C = (uint8_t) temp;
+ temp = (numberToSend<<24)>>24;
+ D = (uint8_t) temp;
+ slave.putc(A);
+ slave.putc(B);
+ slave.putc(C);
+ slave.putc(D);
+ }
+
+ }
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 24 14:15:29 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file