fixed uart issues

This commit is contained in:
Peli de Halleux 2016-10-18 21:47:54 -07:00
parent ae5d5c74a7
commit 6ad59e04a6
3 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# UART Write Number
# UART Write String
### ~hint
![](/static/bluetooth/Bluetooth_SIG.png)

View File

@ -6,7 +6,7 @@ namespace bluetooth {
/**
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.
*/
//% help=bluetooth/uart-write weight=80
//% help=bluetooth/uart-write-string weight=80
//% blockId=bluetooth_uart_write block="bluetooth uart|write string %data" blockGap=8
//% parts="bluetooth" shim=bluetooth::uartWriteString advanced=true
export function uartWriteString(data: string): void {
@ -17,7 +17,7 @@ namespace bluetooth {
/**
* Prints a numeric value to the serial
*/
//% help=serial/write-number weight=79
//% help=bluetooth/uart-write-number weight=79
//% weight=89 blockGap=8 advanced=true
//% blockId=bluetooth_uart_writenumber block="bluetooth uart|write number %value"
export function uartWriteNumber(value: number): void {

View File

@ -43,6 +43,10 @@ namespace pxsim.serial {
return board().serialState.readSerial();
}
export function readUntil(del: string): string {
return readLine();
}
export function onDataReceived(delimiters: string, handler: RefAction) {
let b = board();
b.bus.listen(DAL.MICROBIT_ID_SERIAL, DAL.MICROBIT_SERIAL_EVT_DELIM_MATCH, handler);