summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/main.c b/main.c
index 78916da..db2654d 100644
--- a/main.c
+++ b/main.c
@@ -290,6 +290,7 @@ int main (void)
{
char rand=123;
char gc_x=3, gc_y=3;
+ unsigned char ltrig=0, rtrig=0;
DDRC=0x00;
PORTC=0x00;
@@ -317,10 +318,21 @@ debug(4);
int n_received;
int toggle=0;
+ int count=0;
+ int count2=0;
+ int count3=0;
while(1)
{
toggle=~toggle;
debug(toggle);
+
+ count++;
+ if (count>=1500) count=0;
+ count2++;
+ if (count2>=512-ltrig) count2=0;
+ count3++;
+ if (count3>=25) count3=0;
+
wdt_reset();
usbPoll();
@@ -365,12 +377,14 @@ debug(4);
//debug(temp % 64);
// _delay_ms(0.3);
_delay_us(10);
- char foo[] = { 0x40, 0x03, 0x02 };
-
- if (!(PIND & 0x10))
- foo[2]=0x03;
+ char foo[] = { 0x40, 0x03, 0x00 };
+ //char foo[] = { 0x40, 0x03, 0x02 };
+ if (count2<256 && count3<rtrig/10)
+ foo[2]|=0x01;
+ char foo2=0x00;
+ send_recv_gc(&foo2, 1);
n_received=send_recv_gc(foo, 3);
if (n_received == 64)
{