Electronics,  Serial Library - Processing Discourse board_Electronics.html Electronics,  Serial Library - Processing Discourse en-us Processing Discourse Thu, 22 Mar 2012 06:21:36 +0000 http://blogs.law.harvard.edu/tech/rss 30 Error inside Serial.ports() in exported app num_1251731980.html Processing Discourse/Electronics,  Serial Library num_1251731980.html Tue, 22 Nov 2011 08:24:57 +0000 Welcome back to playing this crazy game we love so much <br /><br />You could wait until the new EP Generations comes out and see if challenges will be introduced again since well be getting memories back in that EP. &nbsp;Itll be out May 31, 2011 here in North America so not too long to wait now Test, just a test num_1321114771.html Processing Discourse/Electronics,  Serial Library num_1321114771.html Sat, 12 Nov 2011 08:19:31 +0000 Hello. And Bye. so so easy walker horse shoes fisher cat num_1320642154.html Processing Discourse/Electronics,  Serial Library num_1320642154.html Sun, 06 Nov 2011 21:02:34 +0000 angiotensin i 'The package "cc" does not exist' (Ubuntu) num_1259105373.html Processing Discourse/Electronics,  Serial Library num_1259105373.html Thu, 17 Jun 2010 15:35:40 +0000 The Arduino website page that discusses 'Arduino and Processing(and Firmata') has two links, one older than the next.<br /> <br />Processing Library: processing-arduino-0017.zip (Updated 22 Sept. 2009) <br /><br /><br />Processing library for arduinoMega: processing-arduinomega.zip (Updated 12 Apr. 2010) <br /><br />I think the contents of the second(newer) Zip file is incomplete; there should be a file called Arduio.jar in the &lt;library&gt; folder.<br /><br />So i installed the contents of the older one and I no longer get the message &nbsp;&quot;The package &quot;cc.arduino does not exist&quot;<br /><br />Dree MiKuadricóptero en ESPAŃOL – Arduino <> Processing num_1271482822.html Processing Discourse/Electronics,  Serial Library num_1271482822.html Mon, 14 Jun 2010 22:22:47 +0000 Un “colega” de otro Foro me ha enviado este video<br /><br />(Yo creo que para destrozarme la moral) &nbsp;<img src="yabbfiles/Templates/Forum/processing_one/cheesy.gif" border="0" alt="Cheesy" title="Cheesy" /><br /><br />http://www.youtube.com/watch?v=MvRTALJp8DM<br /><br />żSerá verdad o es un montaje?<br /><br />Me parece que voy a tener que pedir una “prorroga”, para terminar MiKuadricóptero<br /> XBee Lib: porting Tweet A Watt code to Processing num_1276111549.html Processing Discourse/Electronics,  Serial Library num_1276111549.html Wed, 09 Jun 2010 12:25:49 +0000 I've recently built a <a href="http://www.ladyada.net/make/tweetawatt/" target="_blank">Tweet A Watt</a> wireless power monitor, which uses XBee for data transfer.  I'm attempting to get the Tweet A Watt data into Processing for use in creating some visual energy feedback prototypes.  Using the <a href="http://www.faludi.com/code/xbee-api-library-for-processing/" target="_blank">XBee API Library for Processing</a>, I've made some headway, but have come up against an obstacle that I would appreciate any input on.<br /><br />My sketch looks like this:<br /> <b>Code:</b><pre class="code">&#47;*<br &#47;>XBee Communication Prototype<br &#47;>XBee API Library by &#068;aniel Shiffman and Rob Faludi&#58; http&#58;&#47;&#47;www&#46;faludi&#46;com&#47;code&#47;xbee&#45;api&#45;library&#45;for&#45;processing&#47;<br &#47;>Sample XBee communication code adapted from Tom Igoe&#58; http&#58;&#47;&#47;www&#46;tigoe&#46;net&#47;pcomp&#47;code&#47;category&#47;Processing&#47;148<br &#47;>*&#47;<br &#47;><br &#47;>&#47;&#47;import the xbee and serial libraries&#58;<br &#47;>import xbee&#46;*;<br &#47;>import processing&#46;serial&#46;*;<br &#47;><br &#47;>&#47;&#47; set up Xbee parameters&#58;<br &#47;>Serial port;<br &#47;>XBeeReader xbee;<br &#47;>int rssi = 0;     &#47;&#47; received signal strength<br &#47;>int address = 0;     &#47;&#47; sender's address<br &#47;>int samples = 0;     &#47;&#47; total number of samples<br &#47;>int&#91;&#93; analog;     &#47;&#47; values from the analog I&#47;O pins<br &#47;><br &#47;>void setup&#40;&#41; &#123;<br &#47;>  &#47;&#47; set up xbee<br &#47;>  port = new Serial&#40;this, Serial&#46;list&#40;&#41;&#91;0&#93;, 9600&#41;;<br &#47;>  xbee = new XBeeReader&#40;this, port&#41;;<br &#47;>  xbee&#46;startXBee&#40;&#41;;  <br &#47;>&#125;<br &#47;><br &#47;>void draw&#40;&#41; &#123;&#125;    <br &#47;><br &#47;>&#47;&#47; called every time an XBee event is received&#58; every 2s in the case of the Tweet A Watt<br &#47;>public void xBeeEvent&#40;XBeeReader xbee&#41; &#123;    <br &#47;>   &#47;&#47; Grab a frame of data<br &#47;>   XBee&#068;ataFrame data = xbee&#46;getXBeeReading&#40;&#41;;   <br &#47;> <br &#47;> println&#40;&quot;&quot;&#41;;<br &#47;> println&#40;&quot;LOOP &quot; + hour&#40;&#41; + &quot;&#58;&quot; + minute&#40;&#41; + &quot;&#58;&quot; + second&#40;&#41;&#41;;<br &#47;><br &#47;>    &#47;&#47; Get the transmitter address<br &#47;>    address = data&#46;getAddress16&#40;&#41;;<br &#47;>    println&#40;&quot;API I&#068;&#58; &quot; + address&#41;;    <br &#47;><br &#47;>    &#47;&#47; Get the RSSI<br &#47;>    rssi = data&#46;getRSSI&#40;&#41;;<br &#47;> println&#40;&quot;RSSI&#58; &quot; + rssi&#41;;      <br &#47;>                  <br &#47;> &#47;&#47; Get total number of samples<br &#47;> samples = data&#46;getTotalSamples&#40;&#41;;   <br &#47;> println&#40;&quot;Total Samples&#58; &quot; + samples&#41;;    <br &#47;><br &#47;> &#47;&#47; Output the Analog readings for each sample   <br &#47;> &#47;&#47; ONLY GETS FIRST SAMPLE &#45; How do I access all samples&#63;<br &#47;> for &#40;int i=0; i &lt; samples; i++&#41; &#123;<br &#47;> analog = data&#46;getAnalog&#40;i&#41;;<br &#47;> print&#40;&quot;&#91;&quot;&#41;;<br &#47;> for &#40;int j=0; j &lt; analog&#46;length; j++&#41; &#123;<br &#47;> print&#40;analog&#91;j&#93;&#41;;<br &#47;> if &#40;j &lt; analog&#46;length &#45; 1&#41; &#123; print&#40;&quot;, &quot;&#41;; &#125;<br &#47;> &#125;<br &#47;> print&#40;&quot;&#93;&quot;&#41;;<br &#47;> if &#40;i &lt; samples &#45; 1&#41; &#123; print&#40;&quot;, &quot;&#41;; &#125;<br &#47;> else &#123; println&#40;&quot;&quot;&#41;; &#125;<br &#47;> &#125;<br &#47;>&#125; </pre><br /><br />This all works as expected.  The xBeeEvent is called every 2s, and outputs the correct values for the API ID, RSSI, and Total Samples (19).  However, when outputting the contents of the analog readings,  I seem to be getting the first sample repeated 19 times.  See this sample output:<br /><br /> <b>Code:</b><pre class="code">LOOP 10&#58;37&#58;57<br &#47;>API I&#068;&#58; 1<br &#47;>RSSI&#58; &#45;61<br &#47;>Total Samples&#58; 19<br &#47;>&#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;, &#91;512, &#45;1, &#45;1, &#45;1, 688, &#45;1&#93;<br &#47;><br &#47;>LOOP 10&#58;38&#58;59<br &#47;>API I&#068;&#58; 1<br &#47;>RSSI&#58; &#45;61<br &#47;>Total Samples&#58; 19<br &#47;>&#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93;, &#91;503, &#45;1, &#45;1, &#45;1, 561, &#45;1&#93; </pre><br /><br />As you can see, the first sample is repeated 19 times.  Running the original Python script from the Tweet A Watt software (<i>wattcher.py</i>) outputs a similar reading of the XBee packet, but with 19 distinct samples.  This is the state I'm trying to get to in Processing.<br /><br />In the <a href="http://www.faludi.com/code/xbee-api-library-for-processing/" target="_blank">XBee API Library</a>, the getAnalog() and getAnalog(n) functions are defined as follows:<br /><br /> <b>Code:</b><pre class="code">getAnalog&#40;&#41; – returns an array of integers that represents the current state of each analog channel with &#45;1 indicating that the channel is not configured for analog&#46; Use this when there is only one sample per frame&#46;<br &#47;>getAnalog&#40;int n&#41; – returns the nth sample of analog data as an array of integers with &#45;1 indicating that the channel is not configured for analog&#46; </pre><br /><br />I'm using getAnalog(int n) in the for loop.  Is the issue that I am only getting one &quot;frame&quot; of data, in the call to <b>XBeeDataFrame data = xbee.getXBeeReading();</b>  <br /><br />I've also tried reading the Serial packet directly without using the XBee API Library (with reference to <a href="http://www.tigoe.net/pcomp/code/category/Processing/8" target="_blank">http://www.tigoe.net/pcomp/code/category/Processing/8</a>, <a href="http://processing.org/reference/libraries/serial/Serial.html" target="_blank">http://processing.org/reference/libraries/serial/Serial.html</a>, and <a href="http://ssdl.stanford.edu/ssdl/images/stories/AA236/0708A/Lab/Rover/Parts/xbeeproproductmanual.pdf" target="_blank">http://ssdl.stanford.edu/ssdl/images/stories/AA236/0708A/Lab/Rover/Parts/xbeeproproductmanual.pdf</a>, but my lack of experience in this area makes this a bit of a non-starter.<br /><br />If anyone familiar with the XBee packet, the XBee API Library, or reading Serial data in Processing can assist, it would be greatly appreciated.  I expect that the data is there, I'm just not accessing it correctly.<br /><br />If I've left out anything that would be helpful, please let me know.  Thanks in advance for your help. TCP/IP Sockets Client in Processing + Arduino num_1276092570.html Processing Discourse/Electronics,  Serial Library num_1276092570.html Wed, 09 Jun 2010 07:09:30 +0000 Hello,<br />I am very new to processing and programming in general.<br />I am starting on a project which would send commands (text) to an arduino board connected using a wishield - to a tcp port. I can already send commands using telnet or using a c# based application. I have also seen a java application which can communicate with an arduino based server using java.net and tcp.<br /><br />Can an application be created in processing to do this?<br />If yes can anybody provide an example to get me started.<br /><br />At the same time would it be possible to use the same application to read data from another aduino board connected over serial? A Separate Serial Port Necessary? num_1276067967.html Processing Discourse/Electronics,  Serial Library num_1276067967.html Wed, 09 Jun 2010 00:19:27 +0000 Hello everyone!<br /><br />I'm hoping someone can give me some direction on a project I'm stuck on. Currently, I have an Arduino with a RFID reader sending information to a Processing app. The Arduino sends RFID tag information to Processing via serial connection and Processing then looks up the id in a database to display information on the computer screen accordingly.<br /><br />That part I have working.<br /><br />Now, however, I want Processing to send <i>back</i> to the Arduino a value so that I can do some hardware things depending on what's detected (display text information on a 16x2 LCD display). In Processing, the code to set up the port looks something like this:<br /><br /> <b>Code:</b><pre class="code">String portnum = Serial&#46;list&#40;&#41;&#91;0&#93;&#059;<br &#47;>myPort = new Serial&#40;this, portnum, 2400&#41;&#059;<br &#47;>myPort&#46;buffer&#40;10&#41;&#059; </pre><br />The baud rate is set to 2400 because that's what the RFID reader communicates in. Now I'm want to send values back to the Arduino, in this case just an arbitrary 'A' (ASCII value 65) with: <br /><br /> <b>Code:</b><pre class="code">myPort&#46;write&#40;65&#41;&#059; </pre><br />Where the Arduino simply does a val = Serial.read() But after all my debugging, I don't think anything is being sent back. I suspect that this is not working either because A) myPort is already in use and is busy sending/receiving RFID information and/or B) the baud rate is not 9600 and therefore cannot communicate properly.<br /><br />Do I need to set up multiple serial ports in order to use the RFID reader while also sending other values to the Arduino (to &quot;do other stuff&quot;)? It makes sense that I should be able to do this all on one Arduino, but would it be simpler if I were to just use two Arduinos?<br /><br />Thanks ahead of time for anyone's help on this! I'm really stuck and I can always count on the community to set me straight! which sensor do i need? num_1276056376.html Processing Discourse/Electronics,  Serial Library num_1276056376.html Tue, 08 Jun 2010 22:30:27 +0000 its probably wont be possible to do this with processing alone. You need some hardware to do so. So i would recommend to take a look at arduino, its like processing but focuses on building hardware. http://arduino.cc/ <br /><br />and then just use a standard motion sensor. the ones you know from home that turns your lights on in your front yard. I found 2 tutorials about arduino and motion sensors. <br /><br />take a look<br /><br /><a href="http://blog.hekkers.net/2009/10/07/arduino-and-pir-motion-sensor/" target="_blank">http://blog.hekkers.net/2009/10/07/arduino-and-pir-motion-sensor/</a><br /><br /><a href="http://antipastohw.blogspot.com/2007/12/arduino-with-radion-shack-parallax.html" target="_blank">http://antipastohw.blogspot.com/2007/12/arduino-with-radion-shack-parallax.html</a> pure data processing and arduino real time num_1275806016.html Processing Discourse/Electronics,  Serial Library num_1275806016.html Sat, 05 Jun 2010 23:33:36 +0000 How can I comunicate with pure data processing and arduino real time rss processing to arduino num_1275395354.html Processing Discourse/Electronics,  Serial Library num_1275395354.html Tue, 01 Jun 2010 05:29:14 +0000 Hello sorry for my english ,i'm french<br />I wish to obtain the flow rss to light(to switch on) a led on arduino .if the flow rss taken by processing changes a led starts. I have a processing code to take the rss but I do not know how to code arduino<br />please help me<br /> <b>Code:</b><pre class="code">import processing&#46;serial&#46;*; <br &#47;>  <br &#47;>XMLElement xml; <br &#47;>XMLElement city; <br &#47;>XMLElement temperature; <br &#47;>XMLElement cond; <br &#47;>  <br &#47;>int interval = 10; <br &#47;>int lastTime; <br &#47;>  <br &#47;>String feed = &quot;http&#58;&#47;&#47;www&#46;google&#46;com&#47;ig&#47;api&#63;weather=seoul&amp;;hl=en&quot;; <br &#47;>String location; <br &#47;>String temp; <br &#47;>String condition; <br &#47;>  <br &#47;>&#47;&#47; google api condition value list <br &#47;>String &#91;&#93;condition_list =  &#123; <br &#47;>  &quot;Clear&quot;, &quot;Cloudy&quot;, &quot;Fog&quot;, &quot;Haze&quot;, &quot;Light Rain&quot;, &quot;Mostly Cloudy&quot;, &quot;Overcast&quot;, &quot;Partly Cloudy&quot;, &quot;Rain&quot;,  <br &#47;>  &quot;Rain Showers&quot;, &quot;showers&quot;, &quot;Thunderstorm&quot;, &quot;chance of Showers&quot;, &quot;Chance of Snow&quot;, &quot;Chance of Storm&quot;,  <br &#47;>  &quot;Mostly Sunny&quot;, &quot;Partly Sunny&quot;, &quot;Scattered Showers&quot;, &quot;Sunny&quot;<br &#47;>&#125;; <br &#47;>int condition_index; <br &#47;>  <br &#47;>PFont font_title, font_normal, font_desc; <br &#47;>Serial port;  &#47;&#47; serial that communication with arduino  <br &#47;>  <br &#47;>  <br &#47;>  <br &#47;>  <br &#47;>&#47;&#47; setup section <br &#47;>void setup&#40;&#41; &#123; <br &#47;>  size&#40;800, 400&#41;; <br &#47;>  frameRate&#40;10&#41;; <br &#47;>  <br &#47;>  font_title = loadFont&#40;&quot;18thCentury&#45;40&#46;vlw&quot;&#41;; <br &#47;>  font_normal = loadFont&#40;&quot;18thCentury&#45;20&#46;vlw&quot;&#41;; <br &#47;>  font_desc = loadFont&#40;&quot;18thCentury&#45;14&#46;vlw&quot;&#41;; <br &#47;>  <br &#47;>  fill&#40;255&#41;; <br &#47;>  textFont&#40;font_title, 20&#41;; <br &#47;>  <br &#47;>  String arduinoPort = Serial&#46;list&#40;&#41;&#91;0&#93;; <br &#47;>  port = new Serial&#40;this, arduinoPort, 9600&#41;;  &#47;&#47; connect to Arduino <br &#47;>  <br &#47;>  lastTime = 0; <br &#47;>  fetch&#068;ata&#40;&#41;; <br &#47;>&#125; <br &#47;>  <br &#47;>void draw&#40;&#41;&#123; <br &#47;>  background&#40;0&#41;; <br &#47;>  int n = &#40;interval  &#45; &#40;&#40;millis&#40;&#41; &#45; lastTime&#41;&#47;1000&#41;&#41;; <br &#47;>  <br &#47;>  textFont&#40;font_title, 40&#41;; <br &#47;>  text&#40;&quot;Live WeatherCast&quot;, 10, 40&#41;; <br &#47;>  textFont&#40;font_normal, 20&#41;; <br &#47;>  text&#40;&quot;Reading feed&#58;&quot;, 10, 70&#41;; <br &#47;>  textFont&#40;font_desc, 14&#41;; <br &#47;>  text&#40;feed, 10, 85&#41;; <br &#47;>  <br &#47;>  textFont&#40;font_normal, 20&#41;; <br &#47;>  text&#40;location, 10, 120&#41;; <br &#47;>  textFont&#40;font_desc, 14&#41;; <br &#47;>  text&#40;&quot;temperature &#58; &quot; + temp + &quot;c&quot;, 10, 140&#41;; <br &#47;>  text&#40;&quot;condition &#58; &quot; + condition, 10, 160&#41;;  <br &#47;> <br &#47;>  text&#40;&quot;Next update in &quot; + n + &quot; seconds&#46;&quot;, 10, 200&#41;; <br &#47;>  <br &#47;>  if&#40;n&lt;=0&#41;&#123; <br &#47;>    fetch&#068;ata&#40;&#41;; <br &#47;>    lastTime = millis&#40;&#41;; <br &#47;>  &#125; <br &#47;>&#125; <br &#47;>  <br &#47;>  <br &#47;>void fetch&#068;ata&#40;&#41;&#123; <br &#47;>  String chunk; <br &#47;>  xml = new XMLElement&#40;this, feed&#41;;   <br &#47;>  <br &#47;>  city = xml&#46;getChild&#40;&quot;weather&#47;forecast_information&#47;city&quot;&#41;; <br &#47;>  location = city&#46;getStringAttribute&#40;&quot;data&quot;&#41;; <br &#47;>  println&#40;&quot;location&#58; &quot; + location&#41;; <br &#47;> <br &#47;>  temperature = xml&#46;getChild&#40;&quot;weather&#47;current_conditions&#47;temp_c&quot;&#41;; <br &#47;>  temp = temperature&#46;getStringAttribute&#40;&quot;data&quot;&#41;; <br &#47;>  println&#40;&quot;temperature&#58; &quot; + temp&#41;; <br &#47;>  <br &#47;>  cond = xml&#46;getChild&#40;&quot;weather&#47;current_conditions&#47;condition&quot;&#41;; <br &#47;>  condition = cond&#46;getStringAttribute&#40;&quot;data&quot;&#41;; <br &#47;>  println&#40;&quot;condition&#58; &quot; + condition&#41;; <br &#47;>  <br &#47;>  &#47;&#47;  println&#40;&quot;list&#46;length&#58; &quot;+ condition_list&#46;length + &quot;&#92;n&quot;&#41;;   <br &#47;> <br &#47;>  &#47;&#47; search and get index of condition_list that match with data from google api XML data <br &#47;>  for&#40;int i=0; i&lt; <br &#47;>condition_list&#46;length ; i++&#41;&#123;     <br &#47;>    if&#40;condition_list&#91;i&#93;&#46;equals&#40;condition&#41;&#41;&#123; <br &#47;>      condition_index = i; <br &#47;>      &#47;&#47;    println&#40;&quot;xml_condition&#58; &quot; + condition&#41;; <br &#47;>      println&#40;&quot;&quot;&#41;; <br &#47;>     println&#40;&quot;found match in list index_&quot;+i+&quot; &#58; &quot; + condition_list&#91;i&#93; + &quot; &#33;&#33;&quot;&#41;; <br &#47;>     port&#46;write&#40;condition_index&#41;; <br &#47;>      println&#40;&quot;send index&#58; &#91;&quot;+ i + &quot;&#93; to arduino&#33;&quot;&#41;; <br &#47;>    &#125; <br &#47;>  &#125; <br &#47;>&#125; </pre> Controlling Servo with Firmata num_1275003703.html Processing Discourse/Electronics,  Serial Library num_1275003703.html Thu, 27 May 2010 16:41:43 +0000 We are a working on creating a program where a button input sends data over the internet via Pachube which is received by another Arduino to control a servo. <br /><br />We have gotten this successfully working using Processing and Servo Firmata in Arduino (i.e. my button push on my Arduino controls my teammates servo attached to his Arduino). Unfortunately, as we need to both send and recieve data from the same Arduino (send button push data and recieve data to control servo), we need to use the Standard Firmata. <b>This however doesn't successfully control the servo causing it to buzz and not respond to the recieved data.</b><br /><br />We have experimented trying to adapt the Firmata codes and using just a simpler code for trouble shooting problems as below. When the following code is run on Processing with Servo Firmata it works beautifully but when run with Standard Firmata, it has the same issue and buzzes / doesn't respond properly. <br /><br /><br />import processing.serial.*;<br />import cc.arduino.*;<br />Arduino arduino;<br /><br />int servoPin = 10; // Control pin for servo motor<br /><br />void setup()&#123;<br /> &nbsp;<br />size (180, 50);<br />arduino = new Arduino(this, Arduino.list()[0]);<br />arduino.pinMode(servoPin, Arduino.OUTPUT);<br />// note - we are setting a digital pin to output<br />&#125;<br /><br />void draw()&#123;<br />arduino.analogWrite(servoPin, mouseX); // the servo moves to the horizontal location of the mouse<br />&#125;<br /><br /><br /><br />If anyone has done anything similar or can think of a solution, any help would be much appreciated from this sleep deprived, caffeine driven group of uni students. &nbsp;<img src="yabbfiles/Templates/Forum/processing_one/smiley.gif" border="0" alt="Smiley" title="Smiley" /> Getting external variable in Processing? num_1274892082.html Processing Discourse/Electronics,  Serial Library num_1274892082.html Wed, 26 May 2010 09:41:21 +0000 Ok, so I have a bluetooth serial connection to a robot with a compass attached. I'm trying to get it to send back the heading value to a Processing sketch.<br /><br />here's the recieve code:<br /><br /> <b>Code:</b><pre class="code"><br &#47;>void getHeadingValue&#40;&#41;<br &#47;>  &#123;<br &#47;>    <br &#47;>    if &#40; myPort&#46;available&#40;&#41; &gt; 0&#41; &#123;  &#47;&#47; the available check method returns an int that is the value if the port<br &#47;>    &#47;&#47; if it is more than 0 then it means that there is a value<br &#47;>    rawHeading = myPort&#46;read&#40;&#41;; &#47;&#47;raw heading is whatever the compass returns<br &#47;>    println&#40;&quot;Raw Heading&quot; + rawHeading&#41;;<br &#47;>  &#125;<br &#47;>  else<br &#47;>  &#123;<br &#47;>    println&#40;&quot;myPort is not greater than 0&quot;&#41;;<br &#47;>  &#125;<br &#47;>    <br &#47;>    <br &#47;>  &#125;<br &#47;> </pre><br /><br />As of now it perpetually prints &quot;myPort is not greater than 0&quot;.<br /><br />This is the code I'm trying to get to send heading. I get the right thing printed out over serial, I just need to send it.<br /><br /> <b>Code:</b><pre class="code"><br &#47;>#include &lt;Wire&#46;h&gt;<br &#47;>int HMC6352Address = 0x42;<br &#47;>&#47;&#47; This is calculated in the setup&#40;&#41; function<br &#47;>int slaveAddress;<br &#47;>int ledPin = 13;<br &#47;>boolean ledState = false;<br &#47;>byte heading&#068;ata&#91;2&#93;;<br &#47;>int i, headingValue;<br &#47;>void setup&#40;&#41;<br &#47;>&#123;<br &#47;>&#47;&#47; Shift the device's documented slave address &#40;0x42&#41; 1 bit right<br &#47;>&#47;&#47; This compensates for how the TWI library only wants the<br &#47;>&#47;&#47; 7 most significant bits &#40;with the high bit padded with 0&#41;<br &#47;>slaveAddress = HMC6352Address &gt;&gt; 1;   &#47;&#47; This results in 0x21 as the address to pass to TWI<br &#47;>Serial&#46;begin&#40;9600&#41;;<br &#47;>pinMode&#40;ledPin, OUTPUT&#41;; &#47;&#47; Set the LE&#068; pin as output<br &#47;>Wire&#46;begin&#40;&#41;;<br &#47;>&#125;<br &#47;>void loop&#40;&#41;<br &#47;>&#123;<br &#47;>  &#47;&#47; Flash the LE&#068; on pin 13 just to show that something is happening<br &#47;>  &#47;&#47; Also serves as an indication that we're not &quot;stuck&quot; waiting for TWI data<br &#47;>  ledState = &#33;ledState;<br &#47;>  if &#40;ledState&#41; &#123;<br &#47;>    digitalWrite&#40;ledPin,HIGH&#41;;<br &#47;>  &#125;<br &#47;>  else<br &#47;>  &#123;<br &#47;>    digitalWrite&#40;ledPin,LOW&#41;;<br &#47;>  &#125;<br &#47;>  &#47;&#47; Send a &quot;A&quot; command to the HMC6352<br &#47;>  &#47;&#47; This requests the current heading data<br &#47;>  Wire&#46;beginTransmission&#40;slaveAddress&#41;;<br &#47;>  Wire&#46;send&#40;&quot;E&quot;&#41;;  &#47;&#47; The &quot;Get &#068;ata&quot; command<br &#47;>  Wire&#46;endTransmission&#40;&#41;;<br &#47;>  delay&#40;10&#41;; &#47;&#47; The HMC6352 needs at least a 70us &#40;microsecond&#41; delay<br &#47;>  &#47;&#47; after this command&#46;  Using 10ms just makes it safe<br &#47;>  &#47;&#47; Read the 2 heading bytes, MSB first<br &#47;>  &#47;&#47; The resulting 16bit word is the compass heading in 10th's of a degree<br &#47;>  &#47;&#47; For example&#58; a heading of 1345 would be 134&#46;5 degrees<br &#47;>  Wire&#46;requestFrom&#40;slaveAddress, 2&#41;;  &#47;&#47; Request the 2 byte heading &#40;MSB comes first&#41;<br &#47;>  i = 0;<br &#47;>  while&#40;Wire&#46;available&#40;&#41; &amp;&amp; i &lt; 2&#41;<br &#47;>  &#123; <br &#47;>    heading&#068;ata&#91;i&#93; = Wire&#46;receive&#40;&#41;;<br &#47;>    i++;<br &#47;>  &#125;<br &#47;>  headingValue = heading&#068;ata&#91;0&#93;*256 + heading&#068;ata&#91;1&#93;;<br &#47;>Serial&#46;write &#40;int&#40;headingValue&#41;&#41;;<br &#47;> </pre><br /><br />As of now its not working. Is Serial.write the right method to use for the robot? Getting received data stored in Processing? num_1274737120.html Processing Discourse/Electronics,  Serial Library num_1274737120.html Mon, 24 May 2010 14:38:39 +0000 Hi,<br /><br />I have an Arduino with a compass module that I am getting data from with this code (this is the code loaded onto the robot):<br /><br /> <b>Code:</b><pre class="code"><br &#47;>#include &lt;Wire&#46;h&gt;<br &#47;>int HMC6352Address = 0x42;<br &#47;>&#47;&#47; This is calculated in the setup&#40;&#41; function<br &#47;>int slaveAddress;<br &#47;>int ledPin = 13;<br &#47;>boolean ledState = false;<br &#47;>byte heading&#068;ata&#91;2&#93;;<br &#47;>int i, headingValue;<br &#47;>void setup&#40;&#41;<br &#47;>&#123;<br &#47;>&#47;&#47; Shift the device's documented slave address &#40;0x42&#41; 1 bit right<br &#47;>&#47;&#47; This compensates for how the TWI library only wants the<br &#47;>&#47;&#47; 7 most significant bits &#40;with the high bit padded with 0&#41;<br &#47;>slaveAddress = HMC6352Address &gt;&gt; 1;   &#47;&#47; This results in 0x21 as the address to pass to TWI<br &#47;>Serial&#46;begin&#40;9600&#41;;<br &#47;>pinMode&#40;ledPin, OUTPUT&#41;; &#47;&#47; Set the LE&#068; pin as output<br &#47;>Wire&#46;begin&#40;&#41;;<br &#47;>&#125;<br &#47;>void loop&#40;&#41;<br &#47;>&#123;<br &#47;>  &#47;&#47; Flash the LE&#068; on pin 13 just to show that something is happening<br &#47;>  &#47;&#47; Also serves as an indication that we're not &quot;stuck&quot; waiting for TWI data<br &#47;>  ledState = &#33;ledState;<br &#47;>  if &#40;ledState&#41; &#123;<br &#47;>    digitalWrite&#40;ledPin,HIGH&#41;;<br &#47;>  &#125;<br &#47;>  else<br &#47;>  &#123;<br &#47;>    digitalWrite&#40;ledPin,LOW&#41;;<br &#47;>  &#125;<br &#47;>  &#47;&#47; Send a &quot;A&quot; command to the HMC6352<br &#47;>  &#47;&#47; This requests the current heading data<br &#47;>  Wire&#46;beginTransmission&#40;slaveAddress&#41;;<br &#47;>  Wire&#46;send&#40;&quot;A&quot;&#41;;  &#47;&#47; The &quot;Get &#068;ata&quot; command<br &#47;>  Wire&#46;endTransmission&#40;&#41;;<br &#47;>  delay&#40;10&#41;; &#47;&#47; The HMC6352 needs at least a 70us &#40;microsecond&#41; delay<br &#47;>  &#47;&#47; after this command&#46;  Using 10ms just makes it safe<br &#47;>  &#47;&#47; Read the 2 heading bytes, MSB first<br &#47;>  &#47;&#47; The resulting 16bit word is the compass heading in 10th's of a degree<br &#47;>  &#47;&#47; For example&#58; a heading of 1345 would be 134&#46;5 degrees<br &#47;>  Wire&#46;requestFrom&#40;slaveAddress, 2&#41;;  &#47;&#47; Request the 2 byte heading &#40;MSB comes first&#41;<br &#47;>  i = 0;<br &#47;>  while&#40;Wire&#46;available&#40;&#41; &amp;&amp; i &lt; 2&#41;<br &#47;>  &#123; <br &#47;>    heading&#068;ata&#91;i&#93; = Wire&#46;receive&#40;&#41;;<br &#47;>    i++;<br &#47;>  &#125;<br &#47;>  headingValue = heading&#068;ata&#91;0&#93;*256 + heading&#068;ata&#91;1&#93;;  &#47;&#47; Put the MSB and LSB together<br &#47;>  Serial&#46;print&#40;&quot;Current heading&#58; &quot;&#41;;<br &#47;>  Serial&#46;print&#40;int &#40;headingValue &#47; 10&#41;&#41;;     &#47;&#47; The whole number part of the heading<br &#47;>  Serial&#46;print&#40;&quot;&#46;&quot;&#41;;<br &#47;>  Serial&#46;print&#40;int &#40;headingValue % 10&#41;&#41;;     &#47;&#47; The fractional part of the heading<br &#47;>  Serial&#46;println&#40;&quot; degrees&quot;&#41;;<br &#47;>  delay&#40;500&#41;;<br &#47;>&#125; <br &#47;> </pre><br /><br />How would I get the heading value stored into a processing sketch via Bluetooth?<br /><br />Here's a snippet of my Processing sketch method that creates the serial connection via bluetooth:<br /><br /> <b>Code:</b><pre class="code"><br &#47;><br &#47;>void initializeSerial&#40;&#41;<br &#47;>&#123;<br &#47;>  &#47;&#47;Print serial data and create myPort, the port used for hardware connection<br &#47;>  <br &#47;>  println&#40;Serial&#46;list&#40;&#41;&#41;;<br &#47;>  String portName = Serial&#46;list&#40;&#41;&#91;0&#93;;<br &#47;>  myPort = new Serial&#40;this, portName, 115200&#41;;<br &#47;>  <br &#47;>  if &#40;portName == null&#41;<br &#47;>  &#123;<br &#47;>    println&#40;&quot;portName is null&#33;&#33;&#33;&quot;&#41;;<br &#47;>  &#125;<br &#47;>&#125;<br &#47;> </pre><br /><br />I need someway to get the heading value into this program. How do I do this? Arduino + Accelerometer and Graphing num_1272968810.html Processing Discourse/Electronics,  Serial Library num_1272968810.html Sun, 23 May 2010 00:40:33 +0000 you need to do something like storing your previous values in an array or ringbuffer-type device so you can draw the previous AND the latest sample.<br /><br />because<br /> &nbsp;background(200); //nice light gray here<br />erases the previous lines! <img src="yabbfiles/Templates/Forum/processing_one/smiley.gif" border="0" alt="Smiley" title="Smiley" /><br /><br />or, you could just erase the areas of the screen you're updating, using a filled rect, and draw the new values there. and don't forget to erase any updating text too. &nbsp;and comment out 'background.' &nbsp; Different values on serial monitor and Processing num_1274292315.html Processing Discourse/Electronics,  Serial Library num_1274292315.html Wed, 19 May 2010 12:12:29 +0000 Well I was missing a delay(100); on arduino part, when I added this, The code started to work properly. Web enabled Arduino via Processing num_1273497117.html Processing Discourse/Electronics,  Serial Library num_1273497117.html Sat, 15 May 2010 15:01:26 +0000 Hi, I've been trying to do this as well, but from what I've gathered from various sources is that it's not possible. When you export a Java/Processing applet you lose some functionality for greater security. <br /><br />What I've done alternatively is to use Processing.js (a port of Processing to JavaScript that renders graphics in the HTML5 canvas object) to create the GUI, and PHP to glue it to the Arduino.<br /><br />The advantage of Processing.js is obviously that it allows you to get Processing and the Arduino communicating via a browser, but also that you can display your Processing based GUI on browsers that don't support Java plugins (Android and iPhone for example). The disadvantage is that it won't work natively in Internet Explorer because Microsoft won't implement a standard HTML5 canvas object.<br /><br />There are a few projects created to work around this IE problem though. Error inside serial.ports() num_1273921599.html Processing Discourse/Electronics,  Serial Library num_1273921599.html Sat, 15 May 2010 04:21:28 +0000 are you using 64 bit processor?<br /><br />because that looks like you're trying to use 32 bit libraries: &quot;wrong ELF class: ELFCLASS32&quot;<br /><br />try googling the error...<br /><br />http://www.arduino.cc/playground/Linux/Ubuntu intermittent problems with serial and exported app num_1273732562.html Processing Discourse/Electronics,  Serial Library num_1273732562.html Sat, 15 May 2010 03:57:59 +0000 Since your sketch extends a PApplet, calling super.stop() insures that the normal last-minute stuff gets done. Assuming stop gets called...<br /><br />Unfortunately, yes, the code may be ignored.<br />I suspect that if you use the official JVM and <i>not</i> inside a web browser, you would have better odds.<br /><br />Hope it helps. Can I use auduino usb as serial port? num_1273586330.html Processing Discourse/Electronics,  Serial Library num_1273586330.html Thu, 13 May 2010 20:28:08 +0000 I have solved the problem,you can not run processing and Arduino together,otherwise your com port can not use the same one. Now my problems is it responds slowly,after almost 10 seconds the LED have responds. How to make it responds quickly. Serial.ports() error num_1272857964.html Processing Discourse/Electronics,  Serial Library num_1272857964.html Wed, 05 May 2010 20:56:53 +0000 Went to the website you suggested, downloaded the 64 bit version, put it in to replace the version that came with my latest version of Processing, and - Shazam! - worked perfectly!<br /><br />Thank you, thank you, thank you.<br /> Problem splitting serial feed in Processing num_1272899857.html Processing Discourse/Electronics,  Serial Library num_1272899857.html Wed, 05 May 2010 06:36:26 +0000 I figured out the problem; a delay in the linefeed from Arduino caused the array at index [1] and [2] hadn't been filled with data before I tried to access it.<br />I've now made it wait a full four seconds before actually trying to access the array. Processing Serial Error num_1270948195.html Processing Discourse/Electronics,  Serial Library num_1270948195.html Mon, 03 May 2010 00:10:01 +0000 Which index (number in brackets) does COM5 show up as?<br />Serial.list() on my machine prints:<br /><b>[0]</b> &quot;COM1&quot;<br /><br />So, to use COM1, I would call:<br />myPort = new Serial (this, Serial.list()<b>[0]</b>, 9600); Serial Library for Mobile Processing num_1271575906.html Processing Discourse/Electronics,  Serial Library num_1271575906.html Wed, 28 Apr 2010 09:19:26 +0000 So shall I assume there exists no solution for the same... Proximity Sensor and Processing num_1271155556.html Processing Discourse/Electronics,  Serial Library num_1271155556.html Tue, 27 Apr 2010 20:16:45 +0000 maybe explore a solution with Wiring : <br /><a href="http://wiring.org.co/learning/basics/parallaxping.html" target="_blank">http://wiring.org.co/learning/basics/parallaxping.html</a><br /><br />there are also several examples under the Proximity heading on this page : <a href="http://wiring.org.co/learning/topics/" target="_blank">http://wiring.org.co/learning/topics/</a>