Code for operation of relay switch

Dependencies:   mbed

Revision:
0:845fb927f526
Child:
1:e7eb16963bcb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 02 07:34:11 2015 +0000
@@ -0,0 +1,33 @@
+//checked for pulse duration of 1ms,3ms, 5ms, 100ms, 300ms - working for all!
+
+#include "mbed.h"
+void writereg(uint8_t ,uint8_t );
+uint8_t readreg(uint8_t);
+Serial pc(USBTX, USBRX);
+DigitalOut BCN(D10);                 //slave select or chip select
+DigitalOut TX(D9);                 //slave select or chip select
+
+main()
+{
+    char ch;
+    while(1){
+        printf("press any char\n");
+        ch = pc.getc();
+        //putchar(ch);
+    if(ch == 'A')
+    {
+    //cs2 = 0;    
+    putchar(ch);
+    BCN = 1;
+    wait_ms(5);//min 1 ms
+    BCN = 0;
+    }
+    if(ch == 'B')
+    {
+    //cs1 = 0;
+    putchar(ch);
+    TX = 1;
+    wait_ms(5);//min 1 ms
+    TX = 0;
+    }}
+   }
\ No newline at end of file