Now with added rickrolling. A program to mess with people. Intended for small boards with built in USB sockets that connect direct to the CPU and can easily be hidden behind a computer (e.g. the mBuino).

Dependencies:   USBDevice mbed

Pretends to be a USB mouse and keyboard and has some predefined functions for various things (do a google image search on a set keyword every 5 minutes, move the mouse in a circle, keep turning the capslock key on etc...)

The default is to rickroll the user. It turns caps lock on, when the user turns it off again the program will turns the volume up to max and load a youtube video of Rick Astley. For the next 45 seconds the mouse will do some circles to make it harder to stop the video. It will then wait 10 minutes and loop back to the start.

As google used to say: Don't be evil. But there is nothing wrong with being a little bit naughty.

Files at this revision

API Documentation at this revision

Comitter:
AndyA
Date:
Thu Jan 14 17:00:53 2016 +0000
Parent:
1:f2747e954f10
Commit message:
Added max volume command. Changed default to rickrolling when they turn capslock off.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Dec 17 21:21:06 2015 +0000
+++ b/main.cpp	Thu Jan 14 17:00:53 2016 +0000
@@ -25,6 +25,8 @@
 /// Run image searches at interval seconds for given number of repeats or -1 to run forever
 void startSearches(float interval, int number);
 
+void runCommand(char *address);
+
 // enter a keyboard string
 void sendString(const char *str);
 
@@ -37,14 +39,24 @@
 // Turn caps lock on n seconds after they turn it off.
 void forceCaps(float delay, float checkPeriod=0.5);
 
+void maxVolume();
+void capsOn();
 
 main()
 {
     LEDs = 0;
     wait(10);
-    forceCaps(5);
     while (true) {
-
+        capsOn();
+        while ((keyboard.lockStatus() & 0x02) == 0x02) {
+            wait(1);
+        }
+        maxVolume();
+        runCommand("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
+        drawCircle(80,15);
+        drawCircle(100,15);
+        drawCircle(120,15);
+        wait(60*5);
     }
 }
 
@@ -77,6 +89,15 @@
     searchTicker.attach(doNextSearch,interval);
 }
 
+void runCommand(char *address)
+{
+    keyboard.keyCode('r',KEY_LOGO);  // windows key an R
+    wait(0.1); // delay to give the run box a chance to come up.
+    sendString(address);
+    wait(0.05);
+    keyboard.putc(0x0a); // hit enter
+}
+
 void sendString(const char *str)
 {
     while (*str != 0) {
@@ -85,6 +106,13 @@
     }
 }
 
+void maxVolume()
+{
+    for (int i = 0; i<50; i++) {
+        keyboard.mediaControl(KEY_VOLUME_UP);
+    }
+}
+
 void drawCircle(float radius, float time, bool dir)
 {
 
@@ -170,11 +198,12 @@
     }
 }
 
-void forceCaps(float delay, float checkPeriod) {
+void forceCaps(float delay, float checkPeriod)
+{
     if (checkPeriod == 0)
-      capLockTick.attach(NULL,0);
-    else {     
-      capsWaitPeriod = delay;
-      capLockTick.attach(checkCapsLock,checkPeriod);
-      }
+        capLockTick.attach(NULL,0);
+    else {
+        capsWaitPeriod = delay;
+        capLockTick.attach(checkCapsLock,checkPeriod);
     }
+}