顯示具有 Arduino 標籤的文章。 顯示所有文章
顯示具有 Arduino 標籤的文章。 顯示所有文章

2019年5月11日 星期六

03 網頁程式的開發流程

3.1 開發流程
1. Problem Analysis
2. Web Map and Flowchart / Algorithm Design
3. User Interface Design
4. Coding
5. Verification
3.4 原始檔說明
指示詞
* <%@ 指示詞指令 屬性="屬性值" ..... %>
介面格式碼
* <html xmlns="http://www.w3.org/ .....">.....</html>
    <head>、<title>、<meta> .....

LoRa GL6509 Arduino + Arduino

講師:Marty Chao
marty@browan.com


講義:http://tinyurl.com/tongtui

Arduino Example Code
  • github
  • Download directly


AT command Set
  • AT&H   目前支援的指令集
  • AT+SGMR?  看韌體版號
  • ATZ 重開模組
  • AT+DTTX 發送測試
  • at+dtx=9,"hellolora" 發送資料
    • mqtt return HEX ASCII code
    • AT+DTX=22, 0123456789abcdef012345 發送16進位HEX
  • AT+CSID? Query System ID
  • AT+CPIN? Query PIN code
  • AT+CSQ? Signal strength indication
  • AT+SGMD? MAC and serial number of LMU
  • AT+ECHO=1 enable or disable UART echo respond

Server Side

LAB2

  • Install mqtt client

$pip install paho-mqtt
  • Test dummy py is ok or not
$python Lab00_MQTT_dummy_test.py




LAB3
https://github.com/giot-tw/ServerPython/blob/master/Lab03_VariableResistor_sub.py
https://github.com/giot-tw/Arduino/tree/master/Lab03_giot_VariableResistor







2018年4月25日 星期三

Using FreeRTOS multi-tasking in Arduino

https://www.hackster.io/feilipu/using-freertos-multi-tasking-in-arduino-ebc3cc



 #include <Arduino_FreeRTOS.h>  
 #include <croutine.h>  
 #include <event_groups.h>  
 #include <FreeRTOSConfig.h>  
 #include <FreeRTOSVariant.h>  
 #include <list.h>  
 //#include <message_buffer.h>  
 #include <mpu_wrappers.h>  
 #include <portable.h>  
 #include <portmacro.h>  
 #include <projdefs.h>  
 #include <queue.h>  
 #include <semphr.h>  
 #include <stack_macros.h>  
 //#include <stream_buffer.h>  
 #include <task.h>  
 #include <timers.h>  
 void setup() {  
  // Now set up two tasks to run independently.  
  xTaskCreate(  
   TaskBlink  
   , (const portCHAR *)"Blink"  // A name just for humans  
   , 128 // Stack size  
   , NULL  
   , 2 // priority  
   , NULL );  
  xTaskCreate(  
   TaskAnalogRead  
   , (const portCHAR *) "AnalogRead"  
   , 128 // This stack size can be checked & adjusted by reading Highwater  
   , NULL  
   , 1 // priority  
   , NULL );  
    xTaskCreate(  
   TaskBlink2  
   , (const portCHAR *)"Blink"  // A name just for humans  
   , 128 // Stack size  
   , NULL  
   , 2 // priority  
   , NULL );  
  // Now the task scheduler, which takes over control of scheduling individual tasks, is automatically started.  
 }  
 void loop()  
 {  
  // Empty. Things are done in Tasks.  
 }  
 /*--------------------------------------------------*/  
 /*---------------------- Tasks ---------------------*/  
 /*--------------------------------------------------*/  
 void TaskBlink(void *pvParameters) // This is a task.  
 {  
  (void) pvParameters;  
  // initialize digital pin 13 as an output.  
  pinMode(13, OUTPUT);  
  for (;;) // A Task shall never return or exit.  
  {  
   digitalWrite(13, HIGH);  // turn the LED on (HIGH is the voltage level)  
   vTaskDelay( 1000 / portTICK_PERIOD_MS ); // wait for one second  
   digitalWrite(13, LOW);  // turn the LED off by making the voltage LOW  
   vTaskDelay( 1000 / portTICK_PERIOD_MS ); // wait for one second  
  }  
 }  
 void TaskBlink2(void *pvParameters) // This is a task.  
 {  
  (void) pvParameters;  
  // initialize digital pin 13 as an output.  
  pinMode(13, OUTPUT);  
  pinMode(9, INPUT);  
  for (;;) // A Task shall never return or exit.  
  {  
   if(digitalRead(9)){  
    digitalWrite(13, HIGH);  // turn the LED on (HIGH is the voltage level)  
    vTaskDelay( 200 / portTICK_PERIOD_MS ); // wait for one second  
    digitalWrite(13, LOW);  // turn the LED off by making the voltage LOW  
    vTaskDelay( 200 / portTICK_PERIOD_MS ); // wait for one second  
   }  
  }  
 }  
 void TaskAnalogRead(void *pvParameters) // This is a task.  
 {  
  (void) pvParameters;  
  // initialize serial communication at 9600 bits per second:  
  Serial.begin(9600);  
  for (;;)  
  {  
   // read the input on analog pin 0:  
   int sensorValue = analogRead(A0);  
   // print out the value you read:  
   Serial.println(sensorValue);  
   vTaskDelay(200/portTICK_PERIOD_MS); // one tick delay (15ms) in between reads for stability  
  }  
 }