Skip to content

Instantly share code, notes, and snippets.

@breezhang
Created January 8, 2013 06:43
Show Gist options
  • Save breezhang/4481786 to your computer and use it in GitHub Desktop.
Save breezhang/4481786 to your computer and use it in GitHub Desktop.
powershell setup serial com port or bluetooth modem
#make sure modem stuff
#(hardware flow control set up easy seme as cmd console write-line read-line ...) example bluetooth modem
#if just serial port(USB-RS232)you may be set rts enable
#serial port very slow io you know you need infinite patience
$port = new-Object System.IO.Ports.SerialPort COM7,115200,None,8,one
$port.RtsEnable =$true
start-Sleep -m 1000
$port.Open()
# device init need some time
#program enter sleep that make sure init task complete
start-Sleep -m 2000
$port.WriteLine("at+cbc" +[char]13 +[char]13) # need check out your modem spec siemems s45 [0xd][0xd][0xa]
Start-Sleep -m 50
$port.ReadExisting()
#bluetooth modem and pc standard setup same
$port = new-Object System.IO.Ports.SerialPort COM6
$port.Open()
$port.WriteLine("at+csq")
start-sleep -m 50
$port.ReadExisting()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment