This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getTemp(): | |
global temperature | |
global humidity | |
global tt | |
hum, tempe = Adafruit_DHT.read_retry(sensormodel, sensorpin) | |
humidity = hum | |
humidity = float("{:0.2f}".format(humidity)) | |
temperature = tempe | |
tt = tempe | |
temperature = float("{:0.2f}".format(temperature)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GPIO.setmode(GPIO.BCM) | |
# pins to use | |
pin_pir1 = 23 | |
pin_pir2 = 26 | |
alarm_pin = 21 | |
flite_pin = 17 | |
blite_pin = 27 | |
slite_pin = 22 | |
relay = 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Padding( | |
padding: EdgeInsets.all(4.0), | |
child: Container( | |
width: 300, | |
height: 350, | |
child: WebView( | |
initialUrl: 'http://192.168.43.25:8000', | |
javascriptMode: JavascriptMode.unrestricted, | |
onWebViewCreated: (WebViewController webViewController) { | |
_controller.complete(webViewController); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
void initState() { | |
// TODO: implement initState | |
super.initState(); | |
Timer.periodic(Duration(seconds: 100), (timer) { //ask the server for humuidity value every 100 seconds | |
print('sending periodic message: hh'); | |
widget.channel.sink.add('humidity'); // send message to server | |
setState(() { | |
humidity = humidd; // change the value of temperature with the recent result from server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: iotcontrol | |
description: A new Flutter project. | |
version: 1.0.0+1 | |
environment: | |
sdk: ">=2.1.0 <3.0.0" | |
dependencies: | |
web_socket_channel: ^1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//make sure you have all this packages installed and imported | |
import 'package:flutter/material.dart'; | |
import 'dart:async'; | |
import 'dart:io'; | |
import 'package:mqtt_client/mqtt_client.dart'; | |
import 'package:web_socket_channel/io.dart'; | |
import 'package:web_socket_channel/status.dart' as status; | |
import 'package:web_socket_channel/web_socket_channel.dart'; | |
import 'package:webview_flutter/webview_flutter.dart'; //webview package to view remote camera feed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void https_test() | |
{ | |
char *msg = "080022380000008000009A00000530081329000001081329053020390013"; //already prepared 0800 mess | |
char buff[1024]={0}; | |
char recv[1024]={0}; | |
char *ip = "196.6.103.72"; //test ip | |
int port = 5043; | |
int ret = - 1; | |
int sock = 0; | |
char apn[32]="9mobile"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void test0800() { | |
SDK_8583_ST8583 st_send_packet; | |
s32 len; | |
u8 temp[256]; | |
//transmission date and time | |
u8 tmp[64]; | |
u8 datetime[15]; | |
u8 t_datetime[15] = {0}; |