<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; User Favorites: rbardsley</title>
		<link><a href='http://forums.leaflabs.com/profile.php?id=3774'>3774</a></link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:19:39 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?profile=3774" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5526</link>
			<pubDate>Tue, 05 Jul 2011 08:26:04 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">5526@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;robodude666 - the OP said &#34;I am not a very experienced computer programmer&#34;, so I think they have done well to get code which is so close.&#60;/p&#62;
&#60;p&#62;poslathian - I don't *KNOW* that the USB bug isn't causing a problem, just that the value is plausible.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5524</link>
			<pubDate>Tue, 05 Jul 2011 08:13:03 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">5524@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I dont doubt you guys may be right here - but the USB in 0.0.10-11 was definitely bugging out.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>robodude666 on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5498</link>
			<pubDate>Sat, 02 Jul 2011 08:29:16 +0000</pubDate>
			<dc:creator>robodude666</dc:creator>
			<guid isPermaLink="false">5498@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Quite frankly, something as convoluted as:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;for ( i=1; i&#38;lt;=num_arg; i++) { // convert characters to numeric value
      theSetting += ((temp = (SerialUSB.read() - &#38;#39;0&#38;#39;)) * pow(10.001,num_arg-i));
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;shouldn't work, even if it does work. It's convoluted, difficult to read, and more importantly difficult to debug.&#60;/p&#62;
&#60;p&#62;There are better ways of doing it, like gbulmer pointed out.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5495</link>
			<pubDate>Fri, 01 Jul 2011 19:09:58 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">5495@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;poslathian - I'm not convinced.&#60;/p&#62;
&#60;p&#62;Everything could be working exactly right, but the code is just converting control characters.&#60;/p&#62;
&#60;p&#62;A value in the sub 10,000 range might be explained by reading some sequence of characters like:&#60;br /&#62;
s100\r\n&#60;/p&#62;
&#60;p&#62;by the code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;for ( i=1; i&#38;lt;=num_arg; i++) { // convert characters to numeric value
      theSetting += ((temp = (SerialUSB.read() - &#38;#39;0&#38;#39;)) * pow(10.001,num_arg-i));
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;the 100 will get changed to 10,000 by reading the extra two characters (because of &#60;code&#62;* pow(10.001,num_arg-i))&#60;/code&#62;), and those extra characters will be made negative by the same code:&#60;br /&#62;
&#60;code&#62;theSetting += ((temp = (SerialUSB.read() - &#38;#39;0&#38;#39;)) * pow(10.001,num_arg-i));&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;So the value looks plausible from the code.&#60;/p&#62;
&#60;p&#62;The suggestion to make the value utterly predictable is good. If the value is still rubbish, then it is likely USB, but if it becomes a value which matches the predicted pattern, USB is unlikely to be to blame.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5487</link>
			<pubDate>Fri, 01 Jul 2011 15:42:30 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">5487@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;The problem almost certainly causing your problem has been fixed! see the post here: &#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=894&#38;amp;replies=2#post-5486&#34; rel=&#34;nofollow&#34;&#62;http://forums.leaflabs.com/topic.php?id=894&#38;amp;replies=2#post-5486&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>snigelen on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5484</link>
			<pubDate>Fri, 01 Jul 2011 14:45:02 +0000</pubDate>
			<dc:creator>snigelen</dc:creator>
			<guid isPermaLink="false">5484@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;And remember that the pins used by Serial2 is not 5V tolerant. Serial1 and 3 works fine with a 5V (or 3.3V) serial converter.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5483</link>
			<pubDate>Fri, 01 Jul 2011 14:06:53 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">5483@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;rbardsley,&#60;/p&#62;
&#60;p&#62;  It sounds like SerialUSB.read() is giving you trouble. Verify this is your problem by setting replacing the SerialUSB.read() line in the line that sets theSetting to some known value like '1', and see if it works. &#60;/p&#62;
&#60;p&#62;  What version of libmaple/IDE are you using? We are constantly tweaking SerialUSB but I still see bugs sometimes - If serialUSB.read() is your problem, I recommend using an FTDI chip (or another Arduino, or something with usb&#38;lt;-&#38;gt;serial) temporarily until a serialusb patch fixes your problem. To use an FTDI chip, simply wire tx-&#38;gt;rx_n and rx-&#38;gt;tx_n (rx_n, and tx_n are on maple, and either 1, 2 or 3), then use SerialN.read()/print()/etc. as you would use SerialUSB
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rbardsley on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5439</link>
			<pubDate>Tue, 28 Jun 2011 13:46:18 +0000</pubDate>
			<dc:creator>rbardsley</dc:creator>
			<guid isPermaLink="false">5439@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks gbulmer,&#60;/p&#62;
&#60;p&#62;I'll try to incorporate those revisions. The value displayed to the serial monitor AND the value sent to the slave Arduino are both 7438. So, the wire communication is working, but the values are off.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5437</link>
			<pubDate>Tue, 28 Jun 2011 11:27:40 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">5437@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;So are you saying the text printed on the serial monitor is:&#60;br /&#62;
&#60;code&#62;Sending: 7438&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;or the data sent using the Wire library is 7438, or both?&#60;/p&#62;
&#60;p&#62;The code&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;theSetting = 0;
for ( i=1; i&#38;lt;=num_arg; i++) { // convert characters to numeric value
    theSetting += ((temp = (SerialUSB.read() - &#38;#39;0&#38;#39;)) * pow(10.001,num_arg-i));
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Could be simplified to&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;theSetting = 0;
for ( i=1; i&#38;lt;=num_arg; i++) { // convert characters to numeric value
    theSetting = theSetting*10 + (SerialUSB.read() - &#38;#39;0&#38;#39;);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Which I think is a bit simpler to understand.&#60;/p&#62;
&#60;p&#62;I assume this prints &#34;Error: No value entered.&#34; every time, no matter what, which seems a bit confusing.&#60;/p&#62;
&#60;p&#62;The test:&#60;br /&#62;
&#60;code&#62;if( (num_arg = SerialUSB.available()) &#38;gt; 0 ) {&#60;/code&#62;&#60;br /&#62;
Isn't very robust, and could pick up a line terminator (e.g. carriage return, ASCII 13,  on new line, ASCII 10) which would be very confusing.&#60;/p&#62;
&#60;p&#62;You'd have to restructure the code, but using something like:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;theSetting = 0;
unsigned char c;
while (SerialUSB.available() &#38;amp;&#38;amp; (c=SerialUSB.read()) &#38;amp;&#38;amp; (&#38;#39;0&#38;#39; &#38;lt;= c) &#38;amp;&#38;amp; (c &#38;lt;= &#38;#39;9&#38;#39;)) {
    theSetting = theSetting*10 + (c - &#38;#39;0&#38;#39;);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;would be more robust.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rbardsley on "SerialUSB.read() converting values strangely"</title>
			<link>http://forums.leaflabs.com/topic.php?id=886#post-5435</link>
			<pubDate>Tue, 28 Jun 2011 11:08:54 +0000</pubDate>
			<dc:creator>rbardsley</dc:creator>
			<guid isPermaLink="false">5435@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello.&#60;/p&#62;
&#60;p&#62;I am having trouble converting some of my code from my Arduino setup to my new Maple Rev5 setup. I am using a combination of two boards, one Arduino and one Maple. The Maple board is the master, reads in input from the serial monitor, and sends the values to the Arduino slave. &#60;/p&#62;
&#60;p&#62;The user begins by typing &#34;s&#34; and then the value they want to send. What used to work on the Arduino (s100 would send 100) now turns into (s100 is sending 7438)&#60;/p&#62;
&#60;p&#62;I am not a very experienced computer programmer, so this is a bit beyond me.&#60;/p&#62;
&#60;p&#62;Here is my code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;#include &#38;lt;Wire.h&#38;gt;
#define SLAVE_ID          (2)
#define SEND_theSetting    (11)
int  theSetting = 100;
byte low_byte, high_byte;
byte command, argument[3], num_arg;
byte temp;

void setup()
    {
      // wait for the user to send a character
      while (!SerialUSB.available());
      // consume the character sent
      SerialUSB.read();
    }

    void loop()
    {
        int i;
        switch(command = SerialUSB.read())
        {
                case &#38;#39;s&#38;#39;:
                  if( (num_arg = SerialUSB.available()) &#38;gt; 0 ) {
                    theSetting = 0;
                    for ( i=1; i&#38;lt;=num_arg; i++) { // convert characters to numeric value
                      theSetting += ((temp = (SerialUSB.read() - &#38;#39;0&#38;#39;)) * pow(10.001,num_arg-i));
                    }
                    SerialUSB.print(&#38;quot;Sending: &#38;quot;);
                    SerialUSB.println(theSetting,DEC); // echo calculated hr
                    low_byte  = theSetting &#38;amp; 0xFF;
                    high_byte = theSetting &#38;gt;&#38;gt; 8;
                    Wire.beginTransmission(SLAVE_ID);
                    Wire.send(SEND_theSetting);
                    Wire.send(low_byte);
                    Wire.send(high_byte);
                    Wire.send(theSetting);
                    Wire.endTransmission();
                    break;
                  }
                  SerialUSB.println(&#38;quot;Error: No value entered.&#38;quot;);
                  break;
        } // End switch
    }&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Thanks!!!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "Maple Rev5 + ArduMoto shield"</title>
			<link>http://forums.leaflabs.com/topic.php?id=846#post-5120</link>
			<pubDate>Fri, 10 Jun 2011 14:19:24 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">5120@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ryan,&#60;br /&#62;
  Sorry to hear about the keyboard. You might consider using a cheap USB hub when prototyping so you can fry the ports with impunity.&#60;/p&#62;
&#60;p&#62;via: &#60;a href=&#34;http://www.sparkfun.com/datasheets/Robotics/Ardumoto_v12.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.sparkfun.com/datasheets/Robotics/Ardumoto_v12.pdf&#60;/a&#62;&#60;br /&#62;
It looks like the ardumotor draws its power of Vin, and the two inverters draw from the Vcc line (which on Maple is 3.3V, I assume thats OK for those though).&#60;/p&#62;
&#60;p&#62;On Maple Vin is connected to the input of the onboard regulators, which is determined by your jumper setting. The power selection jumper will source Vin with either the external barrel, the USB 5V, or the lipo input. &#60;/p&#62;
&#60;p&#62;If you did not change the jumper, and were still powered off USB, then Vin would be sourced from USB - the ardumotor would draw from that line (500mA max) and likely trigger the overcurrent protection circuit on your computer's USB controller. If this is the case, the solution is to switch the jumper from USB to Ext. &#60;/p&#62;
&#60;p&#62;Please also note, from the errata (&#60;a href=&#34;http://leaflabs.com/docs/hardware/maple.html#errata&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/hardware/maple.html#errata&#60;/a&#62;) that the barrel jack is 12V max, not 18 as indicated on the silkscreen.&#60;/p&#62;
&#60;p&#62;If you had the jumper set correctly, then its back to the debugging drawing board ;)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rbardsley on "Maple Rev5 + ArduMoto shield"</title>
			<link>http://forums.leaflabs.com/topic.php?id=846#post-5100</link>
			<pubDate>Thu, 09 Jun 2011 08:53:43 +0000</pubDate>
			<dc:creator>rbardsley</dc:creator>
			<guid isPermaLink="false">5100@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Anyone else had any luck getting the ArduMoto board up and running?&#60;/p&#62;
&#60;p&#62;I managed to port my code over correctly. Everything seemed to be up and running correctly. I had LEDs representing the PWM signals pulsing just as they had on my Arduino setup. When I connected my 1800mA 12VDC power source and a pump...&#60;/p&#62;
&#60;p&#62;It threw a USB drawing too much power error on my laptop.&#60;/p&#62;
&#60;p&#62;Now my USB keyboard seems to have stopped working. The ports on my laptop are fine, but my keyboard is definitely toast.&#60;/p&#62;
&#60;p&#62;Any ideas?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;/p&#62;
&#60;p&#62;Ryan
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
