<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/8831" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2014-01-30T10:46:24+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/8831</id>

		<entry>
		<author><name><![CDATA[mayurmacaroni]]></name></author>
		<updated>2014-01-30T10:46:24+02:00</updated>

		<published>2014-01-30T10:46:24+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=8831&amp;p=26526#p26526</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=8831&amp;p=26526#p26526"/>
		<title type="html"><![CDATA[v-USB Arduino HID keyboard]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=8831&amp;p=26526#p26526"><![CDATA[
I have two questions.<br /><br />1 &gt; I am using Metaboard and have uploaded the V-USB code to it for HID keyboard.I have pasted the code below:<br /><br />#include &quot;UsbKeyboard.h&quot;<br /><br />#define BUTTON_PIN 12<br /><br />// If the timer isr is corrected<br />// to not take so long change this to 0.<br />#define BYPASS_TIMER_ISR 1<br /><br />void setup() {<br />  pinMode(BUTTON_PIN, INPUT);<br />  digitalWrite(BUTTON_PIN, HIGH);<br />  <br />#if BYPASS_TIMER_ISR<br />  // disable timer 0 overflow interrupt (used for millis)<br />  TIMSK0&amp;=!(1&lt;&lt;TOIE0); // ++<br />#endif<br />}<br /><br />#if BYPASS_TIMER_ISR<br />void delayMs(unsigned int ms) {<br />   /*<br />  */ <br />  for (int i = 0; i &lt; ms; i++) {<br />    delayMicroseconds(1000);<br />  }<br />}<br />#endif<br /><br />void loop() {<br />  <br />  UsbKeyboard.update();<br /><br />  digitalWrite(13, !digitalRead(13));<br /><br />  if (digitalRead(BUTTON_PIN) == 0) {<br />    <br />    //UsbKeyboard.sendKeyStroke(KEY_B, MOD_GUI_LEFT);<br />    <br />    UsbKeyboard.sendKeyStroke(KEY_H);<br />    UsbKeyboard.sendKeyStroke(KEY_E);<br />    UsbKeyboard.sendKeyStroke(KEY_L);<br />    UsbKeyboard.sendKeyStroke(KEY_L);<br />    UsbKeyboard.sendKeyStroke(KEY_O);<br /><br />    UsbKeyboard.sendKeyStroke(KEY_SPACE);<br /><br />    UsbKeyboard.sendKeyStroke(KEY_W);<br />    UsbKeyboard.sendKeyStroke(KEY_O);<br />    UsbKeyboard.sendKeyStroke(KEY_R);<br />    UsbKeyboard.sendKeyStroke(KEY_L);<br />    UsbKeyboard.sendKeyStroke(KEY_D);<br />    //UsbKeyboard.sendKeyStroke(KEY_B, MOD_GUI_LEFT);<br /><br />    UsbKeyboard.sendKeyStroke(KEY_ENTER);<br />#if BYPASS_TIMER_ISR  // check if timer isr fixed.<br />    delayMs(20);<br />#else<br />    delay(20);<br />#endif<br />    <br />   }<br /><br />}<br /><br />To the above code i have done small modification ie I have removed. if (digitalRead(BUTTON_PIN) == 0)  condition so that the USB keyboard will start typing immediatly after connection the device to USB.But when I flash this modified code and connect the Metaboard to USB I get Problem Installing Device issue  <img class="smilies" src="./../../../images/smilies/icon_eek.gif" alt=":shock:" title="Shocked" /> .Please help me about it .<br /><br />2 &gt; Secondly how to send the Windows key from code .<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=20183">mayurmacaroni</a> — Thu Jan 30, 2014 10:46 am</p><hr />
]]></content>
	</entry>
	</feed>
