* Bluetooth+SBDBT [#rfe9bad1]

|  |*↓挿入口↓|<|<||
|*5|PGEC1 ||STATUS|*10|
|*4|PGED1 ||CTS   |*9 |
|*3|GND   ||RX    |*8 |
|*2|VDD=3V||TX    |*7 |
|*1|RESET ||RTS   |*6 |

###
Arduino arduino;
SBDBT   sbdbt;

sbdbt.gnd = Arduino.gnd;
sbdbt.vdd = Arduino.3V ;
sbdbt.rx  = Arduino.tx ;
sbdbt.tx  = Arduino.rx ;
sbdbt.cts = sbdbt.rts  ;
###


###
void setup() {
  Serial.begin(9600);
}

int c = 0;
void loop() {
  Serial.println(c++);
  delay(500);
}
###

* Python x Arduino [#mfd0c1d4]
*** Python + Pyserial [#q5d690bb]

### python
  #need pyserial:
  # $> pip install pyserial
  
  import serial
  
  seri = serial.Serial("COM11", 9600, timeout=1000)
  print("Open [{}]".format(seri))
  
  try:
    while True:
      line = seri.readline()
      value = int(line)
      print(value)
      if value != 1:
        print("Emergency Stop!")
        break      
  except:
    print("Error Stop!!")
  finally:
    seri.close()
###

*** Arduino + [#b2b91c98]
*** Arduino + Serial [#b2b91c98]

### cpp
  int iSwitch = 2;
  int oLedOn  =  3;
  int oLedOff = 10;
  
  void setup(){
    pinMode(iSwitch, INPUT);
    pinMode(oLedOn , OUTPUT);
    pinMode(oLedOff, OUTPUT);
    Serial.begin(9600);
    Serial.write("Heart Beat Start");
  }
  
  void loop(){
    int vSwitch = digitalRead(iSwitch);
    digitalWrite(oLedOn ,  LOW);
    Serial.print(vSwitch);
    Serial.println("");
    digitalWrite(oLedOff, !vSwitch);
    delay(10);
    digitalWrite(oLedOn ,  vSwitch);
    delay(90);
  }
###

* [#r1a1cf01]
    技術 一覧 検索 最新 バックアップ リンク元   ヘルプ   最終更新のRSS