PIC code for The Zero-G Eye.
#include <16F84.h> #fuses HS,NOWDT,NOPROTECT,PUT #use Delay(Clock=10000000) #use fast_io(B) #use RS232(Baud=38400, Xmit=PIN_B1, Rcv=PIN_B5) #define TORADIO PIN_A2 void wait_ten(int i) { for( ; i!=0 ; i--) delay_us(10); } main() { int c; int POS1, POS2, POS3, POS4, POS5, POS6; POS1 = 125; POS2 = 125; POS3 = 125; POS4 = 125; POS5 = 125; POS6 = 125; c = 0x00; set_tris_b(0x30); while(1){ c = 0x00; do{c = getchar();} while(c != 0xFF); POS1 = getchar(); POS2 = getchar(); POS3 = getchar(); POS4 = getchar(); POS5 = getchar(); POS6 = getchar(); OUTPUT_LOW(TORADIO); delay_us(400); OUTPUT_HIGH(TORADIO); wait_ten(POS1); OUTPUT_LOW(TORADIO); delay_us(400); OUTPUT_HIGH(TORADIO); wait_ten(POS2); OUTPUT_LOW(TORADIO); delay_us(400); OUTPUT_HIGH(TORADIO); wait_ten(POS3); OUTPUT_LOW(TORADIO); delay_us(400); OUTPUT_HIGH(TORADIO); wait_ten(POS4); OUTPUT_LOW(TORADIO); delay_us(400); OUTPUT_HIGH(TORADIO); wait_ten(POS5); OUTPUT_LOW(TORADIO); delay_us(400); OUTPUT_HIGH(TORADIO); wait_ten(POS6); OUTPUT_LOW(TORADIO); delay_us(400); OUTPUT_HIGH(TORADIO); } }