|
このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。 |
This page is browser friendly, by the way. Make your browser's window いっそう少なく wide than your whole 審査する and you will find the narrower columns much easier to read. For more tips, see my 力/強力にする Browsing hints.
I 堅固に recommend that you at least skim through the (警察などへの)密告,告訴(状) on my page about how this code was developed, but if you want just "the answer", here it is. At least here is the Arduino half of things. You also need "bespoke" (弁護士の)依頼人 ソフトウェア to 接近 the server which is created by the に引き続いて. (解放する/自由な (弁護士の)依頼人 ソフトウェア is 利用できる. See the 開発 page, link above.)
Remember: To 接近 the ArduSimpSrv, you need "bespoke" (弁護士の)依頼人 code. One program which can send requests to an ArduSimpSrv is my 解放する/自由な Windows program, TCP006. I hope someone will 令状 an 同等(の) program for Linux, and let me 地位,任命する a link to it here.
Fancier (弁護士の)依頼人 programs... one to 記録,記録的な/記録する the data 存在 seen by the ArduSimpSrv, perhaps?... is certainly possible. One server can service many needs.
It may be a bad idea to use any of the に引き続いて at the same time as a W5100 based 保護物,者....
... and D13, but this last one only if you "care" that on the 保護物,者 it goes to an LED, and from there through a resistor to ground. (This 単に 平行のs the same thing on many Arduino and clone boards... BUT, to digress from the digression, BE AWARE that the ソフトウェア behind "体制/機構()" and "宙返り飛行()" pulse D13 high 簡潔に before 遂行する/発効させるing whatever you 明示するd in "体制/機構()".)
Of course, I unwittingly used some of those lines in my designs. The designs SEEM to work, but it would be a good idea to take what I've put on those lines and move them どこかよそで. I will 徐々に be 改訂するing my designs as follows....
In every 事例/患者, to 修正する the ソフトウェア is 平易な... but you will need to look carefully to see whether what is 現在/一般に online has been 修正するd or not.
To change the line used for, say, the phototransistor watching the LED in, say, ArduServer2, the line....
(弁護士の)依頼人.print("<br>Analog input 0 reads: <b>");
(弁護士の)依頼人.print(analogRead(0));
... must be changed to...
(弁護士の)依頼人.print("<br>Analog input 1 reads: <b>");
(弁護士の)依頼人.print(analogRead(1));
... and you are done! (You'll have to move one wire on your breadboard, too, if you had it wired for the 初めの design.)
(Digression: Is nothing every 平易な? In 99.0% of my code, such a change would 単に have been a 事柄 of changing something like the "const byte bLEDpin=8;" at the start of the program. But in this 事例/患者, to 避ける fighting with... not hard... getting the 誘発する to identify the channel, I took a shortcut and 明示するd the channel explicitly instead of a 全世界の variable. Sigh.
Sorry! I could have done without this, too! When will the 公式の/役人 Arduino 場所/位置 have proper documentation of the ethernet 保護物,者 and library??
//
// TCP005: A simple server... not a web server... for Arduino..
// An 拡大するd TCP004, which illustrates the 核心 elements.
// 要求するs 目的 written (弁護士の)依頼人 ソフトウェア.... see below.
// See http://sheepdogguides.com/arduino/art5simpsrv.htm for 詳細(に述べる)s
//見解/翻訳/版: 11 Oct 2011 (with some tweaks done on webpage)
//N.B. THE FOLLOWING ALSO "define" the 見解/翻訳/版. And they can
// be read by the (弁護士の)依頼人, with 命令(する) $7E.
//These MUST be 始める,決める to printable ASCII, e.g 'A' or 65, as
// the (弁護士の)依頼人 ソフトウェア 推定する/予想するs this.
//The checksum can be in the 範囲 0-255
static uint8_t bVerMostSB='0';
static uint8_t bVerMidSB='0';
static uint8_t bVerLSB='1';
// 要求するs 目的-(手先の)技術d (弁護士の)依頼人 ソフトウェア.
// TCP002.exe in....
// http://sheepdogguides.com/zips/TCP001.zip
// ... is suitable. for 接近ing the BB 82
// 命令(する) and (static) 返答.
// If you know of, or have written, Linux
// 同等(の)s, please 接触する http://sheepdogguides.com/
//
// This code is in the public domain.
//
// It 要求するs a W5100 based ethernet interface, although 変えるing
// the ソフトウェア to run with a Microchip ENC28J60 should not be hard.
//To do: 追加する "read 1-Wire"... and make (弁護士の)依頼人 s/w dongleable 経由で 1-Wire 半導体素子?
#含む <SPI.h>
#含む <Ethernet.h>
//The に引き続いて 決定する the MAC 演説(する)/住所 and IP 演説(する)/住所
// that will be in the ethernet 保護物,者 on your Arduino.
//Both must be unique on your LAN
uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE };
uint8_t ip[] = { 192,168,0,242 };
//The に引き続いて 決定するs what port the server will listen on.
int iSPort = 5202;
Server server(iSPort);
boolean boLEDOn;//To do with 非,不,無-必須の LED on/off stuff
uint8_t bLEDpin=8;//To do with 非,不,無-必須の LED on/off stuff
//ソフトウェア assumes an LED-with-resistor on this pin. See LEDon,
//LEDoff subroutines.
//(Pin 13 unsuitable, for some 推論する/理由, when using Ethernet プロの/賛成の 金物類/武器類)
uint8_t bBeepPin=7;//Pin a sounder will be connected to. Pin
//high: Beep on, low: off.
uint8_t bBeepDur=10;
//Length of beep, in milliseconds. Do not make this longer
// than you can help. The system is 封鎖するd while the beep
// is on. (Too short, and the sounder can't sound, though.)
//N.B.The pins defined by bLEDpin and bBeepPin will be configured as an 生産(高)...
//be careful to match your program with your 金物類/武器類!
int iCommandsAccepted;//Where we count how many 命令(する)s have come in,
// or things that we thought might be 命令(する)s...
uint8_t 返答[68];
// N.B. Size of 返答 限られた/立憲的な by what you put in 事前の line.
// Be careful not to 侵略(する)/超過(する) the 衝撃を和らげるもの.
uint8_t bRespLen;
boolean boValidCommand;
無効の Beep(){
digitalWrite(bBeepPin,HIGH);
延期する(bBeepDur);
digitalWrite(bBeepPin,LOW);
};
無効の LEDOn(){
//公式文書,認める that this makes the 仮定/引き受けること that the LED+resistor
// go to GND from the 生産(高) pin controlling them
//Just change "HIGH" to "LOW" if your LED is wired the other
// way.
digitalWrite(bLEDpin,HIGH);
boLEDOn=true;
}
無効の LEDOff(){
//公式文書,認める that this makes the 仮定/引き受けること that the LED+resistor
// go to GND from the 生産(高) pin controlling them
//Just change "LOW" to "HIGH" if your LED is wired the other
// way.
digitalWrite(bLEDpin,LOW);
boLEDOn=誤った;
}
無効の ProcessBB82(){
uint8_t *r = 返答;
*r++ = 0xBB;
*r++ = 0x82;
*r++ = 0x01;
*r++ = 0x01;
*r++ = 0xFF;
*r++ = 0xFF;
bRespLen=6;
boValidCommand=true;
}
無効の Process7E81(){
// 報告(する)/憶測 見解/翻訳/版 (警察などへの)密告,告訴(状) to (弁護士の)依頼人.
// This 決まりきった仕事 as yet untested, as a way to call
// it does not 存在する in the (弁護士の)依頼人 ソフトウェア
uint8_t *r = 返答;
*r++ = 0x7E;
*r++ = 0x54;
*r++ = bVerMostSB;
*r++ = bVerMidSB;
*r++ = bVerLSB;
*r++ = bVerMidSB ^ bVerLSB;//XOR the bytes (checksum)
bRespLen=6;
boValidCommand=true;
}
無効の Process7F80(){
uint8_t bMS=iCommandsAccepted >> 8;//MSB of iCommandsAccepted
uint8_t bLS=iCommandsAccepted & 0xFF;//LSB of iCommandsAccepted
uint8_t *r = 返答;
*r++ = 0x7F;
*r++ = 0x55;
*r++ = bMS;
*r++ = bLS;
*r++ = bMS ^ bLS;//XOR the bytes (checksum)
bRespLen=5;
boValidCommand=true;
}
無効の Process50AF(){
LEDOff();
uint8_t *r = 返答;
*r++ = 0x50;
*r++ = 0x00;
*r++ = 0x05;
bRespLen=3;
boValidCommand=true;
}
無効の Process51AE(){
LEDOn();
uint8_t *r = 返答;
*r++ = 0x51;
*r++ = 0x00;
*r++ = 0x04;
bRespLen=3;
boValidCommand=true;
}
無効の Process718E(){
uint16_t iAn1=analogRead(1);
uint8_t bMS=iAn1 >> 8;//MSB of iAn1
uint8_t bLS=iAn1 & 0xFF;//LSB of iAn1
uint8_t *r = 返答;
*r++ = 0x71;
*r++ = 0x51;
*r++ = bMS;
*r++ = bLS;
*r++ = bMS ^ bLS;//XOR of data bytes, "checksum"
bRespLen=5;
boValidCommand=true;
}
無効の 体制/機構(){
iCommandsAccepted=0;
pinMode(bLEDpin,OUTPUT);
LEDOn();//Also makes boLEDOn true.
pinMode(bBeepPin,OUTPUT);
digitalWrite(bBeepPin,LOW);
// Initialize the W5100 ethernet 半導体素子
Ethernet.begin(mac, ip);
// Start the serial library (for debug 生産(高))
// The serial 監視する is not 要求するd for the server's 操作/手術.
Serial.begin(9600);
// Start the TCP server
Serial.print("開始 server...\n");
server.begin();
}
無効の 宙返り飛行(){
(弁護士の)依頼人 c = server.利用できる();
if (c.connected()) {
Serial.print("後継の 関係!\n");
// Read two bytes from (弁護士の)依頼人
uint8_t b1 = c.read();
uint8_t b2 = c.read();
++iCommandsAccepted;
// Debugging: Show me what the (弁護士の)依頼人 sent
Serial.print("The (弁護士の)依頼人 said 0x");
Serial.print(b1,HEX);
Serial.print(" 0x");
Serial.print(b2,HEX);
Serial.print(" ");
Serial.print(iCommandsAccepted);
Serial.print("\n");
// を取り引きする the 命令(する)...
boValidCommand=誤った;//始める,決める true within a 命令(する) 加工業者, if one 設立する
if ((b1 == 0x50) and (b2==0xAF)) Process50AF();
if ((b1 == 0x51) and (b2==0xAE)) Process51AE();
if ((b1 == 0x71) and (b2==0x8E)) Process718E();
if ((b1 == 0x7E) and (b2==0x81)) Process7E81();
if ((b1 == 0x7F) and (b2==0x80)) Process7F80();
if ((b1 == 0xBB) and (b2==0x82)) ProcessBB82();
// Send 返答
if (boValidCommand) {
c.令状(返答,bRespLen);
Beep();//It would be possible to move this
//to within the handlers of selected
//命令(する)s, if you did not want a beep
//for EVERY 命令(する) 過程d.
//Or, どこかよそで, it would 報告(する)/憶測 all
//requests for service, whether valid or not.
}
};//End of if c.connected (then...) 封鎖する
// の近くに the 関係... TKB: の近くに 関係 or stop server? Don't want latter!
//TKB REMMED OUT, as CONNECTION REPEATEDLY CLOSED...
//c.stop();
//seems to work! (Didn't (適切に) with c.stop... server shut 負かす/撃墜する?
}//end of 宙返り飛行()
Remember: The code is explained for you at my page explaining the ArduSimpSrv 創造.
Page 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org
CSS behind the page checked, at least once upon a time!, with http://jigsaw.w3.org/css-validator/
Why does this page 原因(となる) a script to run? Because of the Google パネル盤s, and the code for the search button. Also, I have some of my pages' traffic 監視するd for me by eXTReMe tracker. They 申し込む/申し出 a 解放する/自由な tracker. If you want to try one, check out their 場所/位置. Why do I について言及する the script? Be sure you know all you need to about spyware.
....... P a g e . . . E n d s .....