Browse Source

cleaned example

master
Robin Thoni 9 years ago
parent
commit
a4777fa17b
1 changed files with 5 additions and 16 deletions
  1. 5
    16
      examples/UsbRawDemo1/main.ino

+ 5
- 16
examples/UsbRawDemo1/main.ino View File

9
 
9
 
10
 void callback(CALLBACK_ARGS)
10
 void callback(CALLBACK_ARGS)
11
 {
11
 {
12
-    /*digitalWrite(ledPin, !digitalRead(ledPin));
13
-    delay(100);*/
14
-
15
-    /*if (data)
16
-    {
17
-        strcpy((char *) buffer, (const char *) data);
18
-
19
-        digitalWrite(ledPin, !digitalRead(ledPin));
20
-        delay(200);
21
-        digitalWrite(ledPin, !digitalRead(ledPin));
22
-    }*/
23
-
24
     if (rq->bRequest == 0)
12
     if (rq->bRequest == 0)
25
     {
13
     {
26
         digitalWrite(ledPin, 0);
14
         digitalWrite(ledPin, 0);
29
     {
17
     {
30
         digitalWrite(ledPin, 1);
18
         digitalWrite(ledPin, 1);
31
     }
19
     }
20
+    else if (rq->bRequest == 2)
21
+    {
22
+        dev->setDataString((const char*)buffer);
23
+    }
32
     else if (rq->bRequest == 4)
24
     else if (rq->bRequest == 4)
33
     {
25
     {
34
         if (data)
26
         if (data)
35
         {
27
         {
36
-            digitalWrite(ledPin, !digitalRead(ledPin));
37
-            delay(200);
38
-            digitalWrite(ledPin, !digitalRead(ledPin));
39
             strcpy((char *) buffer, (const char *) data);
28
             strcpy((char *) buffer, (const char *) data);
40
         }
29
         }
41
         else
30
         else
45
     }
34
     }
46
     else
35
     else
47
     {
36
     {
48
-        dev->setData(buffer, strlen((const char*)buffer) + 1);
37
+        dev->setDataUsbNoMsg();
49
     }
38
     }
50
 }
39
 }
51
 
40
 

Loading…
Cancel
Save