支持系统
OS X 10.7
价格
0
下载次数
246
官方网站
Httpserial bridges a connection between the http protocol and serial devices on your computer. This app was specifically written for serial devices connected to a USB port, such as the Arduino, or other microcontroller. This allows for communication with such devices using only your web browser. With this app running, you can send data to serial devices directly from URLs in your browser's location bar, or by using Javascript. When running, Httpserial listens to URL requests to "localhost" at the port specified under the "Advanced" tab. For example, with the port set to 9080, the URL http://localhost:9080/hello, will send the text "hello" over the serial port at the baud rate (and N,8,1) specified under the "Advanced" tab. Note that after issuing this URL, the browser will await a response. It is thus necessary for the serial-device to send a response back, which Httpserial will route back as the proper http-response. It is thus necessary to have software running on the microcontroller to process and otherwise respond to serial text sent to it. The user will find such sample code for the Arduino, under the app's "Arduino Code" tab, that responds to the following serial text strings. (Note: Below, "Response from Arduino" means the Arduino will send the said information back over the serial port, which Httpserial will route back to the http-caller, as the response to the http-request. If, for example, you send data to the serial port via a URL (as above), you'll see the response directly in your web browser.) Send: hello Response from Arduino: Hello Send: di,n Response from Arduino: set pin n to a digital input Send: do,n Response from Arduino: set pin n to a digital output Send: dw,n,x Response from Arduino: digital write x (1 or 0) to pin n Send: dr,n Response from Arduino: digital read from pin n Send: ar,n Response from Arduino: analog read from pin n,converted to a voltage (0..5V) Send: dl,x Response from Arduino: delay the Arduino code execution by x milliseconds Send dm,n1,v1,n2,v2,n3,v3... Response from Arduino: Stands for "digital many," and writes v1 to pin n1, v2 to pin n2, v3 to pin n3, etc. Send: arm,n1,n2,n3... Response from Arduino: Stands for "analog read many," and reads analog values from analog ports n1, n2, n3 The app itself contains sample Javascript code, that will drive the basic Arduino functions as delivered by the "Arduino Code," with browser buttons and text-fields. For the LED functionality, just observe the LED connected to pin 13, or insert your own LED with the anode of the LED inserted into pin 13, and the cathode into ground. Note that Httpserial also carefully handles (and allows for) cross site scripting via the JSONP protocol. This means that a website may drive your Arduino using Javascript. Demonstrations of this functionality can be found on Codebymath.com, where simple programming exercises that make use of mathematical concepts with Arduino programming can be found. That is, user interactions with the Codebymath.com website end up sending serial strings to the Arduino attached to the user's computer, making the Arduino respond in kind.