dalts.net
域名年龄: 17年2个月23天HTTP/1.1 301 永久重定向 访问时间:2014年03月06日 23:56:06 目标网址:http://dalts.net/ 动作:Accept-Encoding Content-Encoding: gzip 文件大小:186 Keep-Alive: timeout=2, max=100 连接:Keep-Alive 类型:text/html; charset=iso-8859-1 HTTP/1.1 200 OK 访问时间:2014年03月06日 23:56:06 修改日期:2012年12月31日 05:13:48 网页标记:"c71e-4d2185f5fbb00" 接受单位:字节 动作:Accept-Encoding Content-Encoding: gzip 文件大小:13976 Keep-Alive: timeout=2, max=100 连接:Keep-Alive 类型:text/html 页面编码:utf-8
dalts.netKind Acts of RandomnessRSSBlogArchivesArduino Controlled Raspberry PI Pandora RadioOct 15th, 2012We have a nicely running little Raspberry PI that we use as a Pandora radio at the Gold Coast TechSpace.It’s a great setup and people have enjoyed upping and downing tracks on the playlists to get a good mix of tunes that we all like.We run the pianobar application which gives a really simple command line interface that works beautifully with us.I wanted to make it even better by having some big buttons that people could hit to like/dislike a track or just move on to the next (don’t want to ban it - just tired of it).How could I do this simply? Well - I realised that by replacing the DFU bootloader you can turn any Arduino into a HID device to control keyboard and mouse (imagine the prank opportunities here people!)Anyway - here is my MVP (Minimum Viable Product) that is now being used at the space and getting me early feedback.I don’t have the big buttons yet, I’ve just hooked up some simple little push buttons to a breadboard and an Arduino (Freetronics Eleven). Once I get it more finished I might move it to a Leostick.Here is my initial arduino sketch, I realise now there are better ways to handle multiple presses in hardware using interupt lines or capacitors, but for my initial release this seemed to work:12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061uint8_t buf[8] = {0 }; /* Keyboard report buffer */#define PIN_LOVE 5#define PIN_HATE 6#define PIN_NEXT 7#define LED 13int love = 1;int hate = 1;int next = 1;int state = 1;void setup(){Serial.begin(9600);pinMode(PIN_LOVE, INPUT);pinMode(PIN_HATE, INPUT);pinMode(PIN_NEXT, INPUT);// enable internal pull-upsdigitalWrite(PIN_LOVE, 1);digitalWrite(PIN_HATE, 1);digitalWrite(PIN_NEXT, 1);delay(200);}void loop(){state = digitalRead(PIN_LOVE);if (state != 1 && love == 1) {buf[2] = 87; // + keySerial.write(buf, 8); // Send keypressreleaseKey();}love = state;state = digitalRead(PIN_HATE);if (state != 1 && hate == 1) {buf[2] = 86; // - keySerial.write(buf, 8); // Send keypressreleaseKey();}hate = state;state = digitalRead(PIN_NEXT);if (state != 1 && next == 1) {buf[2] = 17; // n keySerial.write(buf, 8); // Send keypressreleaseKey();}next = state;}void releaseKey(){buf[0] = 0;buf[2] = 0;Serial.write(buf, 8); // Release key }Note: The numbers you see for the keypresses are not ASCII codes - you need to refer to the HID spec to get the correct codes for your keyboard.Upload the sketch to the Arduino, the board will be doing nothing until you load the keyboard firmware. To do this you have to use the dfu_programmer utility that is in the standard ubuntu repos.However for it to work, you need to reset the DFU so it can take commands, to find out all about this have a look at the DFU programming guide - the key section is “Reset the 8u2”.This is what I did:j
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-06-20 09:43, Process in 0.0036 second.