flutter micropython raspberry pi pico ble hc-08 servo demo, source in the description

preview_player
Показать описание
#micropython
#ble
#hc-08
#flutter

replace _GT_ with greater than symbol
replace _LT_ with less than symbol
youtube don't like angle brackets on the description
pico micropython using ble hc-08 and servo
android app uses flutter
# pico hc-08
# gpio4 -- rxd
# gpio5 -- txd
#
# gpio15 -- servo signal
#
from machine import UART, PWM, Pin
from micropython import const
import time
import struct

CENTER = const(4987) # center for this servo
u=UART(1,baudrate=9600) # gpio4--rxd, gpio5--txd
pwm=PWM(Pin(15))
buffer = bytearray(4)
while True:
value = buffer[0] if buffer[0] _LT_ 130 else buffer[0] - 255
duty = CENTER + value

// give location permission to the app
//dependencies:
// flutter:
// sdk: flutter
// get:
// flutter_reactive_ble:

void main() =_GT_ runApp(GetMaterialApp(home: Home()));

class Home extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('BLE demo')),

body: Row(
children: [

RotatedBox(quarterTurns:3,
child: ElevatedButton(
style: TextStyle(fontSize:25,

RotatedBox( quarterTurns:3, child: Obx(() =_GT_ Slider( // put Obx to rebuild widget
min: -120.0,
max: 120.0,
divisions: 24,
onChanged: (double value) {
},))),]));}}

import 'dart:async';
import 'dart:typed_data';

class BleController {
final frb = FlutterReactiveBle();
late StreamSubscription _LT_ConnectionStateUpdate_GT_ c;
late QualifiedCharacteristic tx;
final devId = '9C:1D:58:0F:3B:D8'; // use nrf connect from playstore to find
var status = 'connect to bluetooth'.obs;

Int8List int32Bytes(int value) =_GT_

void setValue(val) async {
Int8List li = int32Bytes(i);
}

void connect() async {

tx = QualifiedCharacteristic(
deviceId: devId);}});}}
Рекомендации по теме
Комментарии
Автор

hello bro i want to make projects using raspberry pi pico and flutter can you help me how and were can i learn every thing

sirps
welcome to shbcf.ru