Browse Source

cleaned example

master
Robin Thoni 4 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,18 +9,6 @@ uchar buffer[50];
9 9
 
10 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 12
     if (rq->bRequest == 0)
25 13
     {
26 14
         digitalWrite(ledPin, 0);
@@ -29,13 +17,14 @@ void callback(CALLBACK_ARGS)
29 17
     {
30 18
         digitalWrite(ledPin, 1);
31 19
     }
20
+    else if (rq->bRequest == 2)
21
+    {
22
+        dev->setDataString((const char*)buffer);
23
+    }
32 24
     else if (rq->bRequest == 4)
33 25
     {
34 26
         if (data)
35 27
         {
36
-            digitalWrite(ledPin, !digitalRead(ledPin));
37
-            delay(200);
38
-            digitalWrite(ledPin, !digitalRead(ledPin));
39 28
             strcpy((char *) buffer, (const char *) data);
40 29
         }
41 30
         else
@@ -45,7 +34,7 @@ void callback(CALLBACK_ARGS)
45 34
     }
46 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