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> .....

02 VSE開發環境介紹

2.1 建立新網站
選擇 ASP.NET空網站
使用VB語言
系統自動產生Web.config
在方案總管新增Web Form (.aspx)
 - code behind model or inline code separation model
於Web Form的div輸入文字

2.2 VSE整合開發環境介紹
各窗格簡介
2.2.3 工具箱
Server Controls
 - 標準控制項、資料控制項、驗證控制項、巡覽控制項、登入控制項、AJAX擴充功能控制項、HTML控制項

#VSE設定匯出:工具——設定——匯入與匯出設定

2.3 建立與操作Web Form的控制項
<%@Page Language="VB" %>
 - @Page指示詞
runat="server"
 - 由伺服器進行編譯與執行
2.3.1 建立控制項
於form中加入標籤控制項
2.3.2 絕對定位
點選div
拖曳div範圍,使之變大
新增標籤控制項
點選標籤控制項
執行『格式&位置』
按下『絕對定位』
即可將標籤拖曳至任意位置
*這是利用CSS語法來設定控制項位置

#程式碼顏色:綠色為修改並儲存,黃色為修改未儲存


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月26日 星期四

觀察指標及變數經過操作在記憶體中的變化

#include <stdio.h>
#include <stdlib.h>

char * get(int i){
static char str1[]="b   ";
static char str2[]="a   ";
static char str3[]="ptr1";
static char str4[]="ptr2";
switch(i){
case 0:


return str4;

case 1:


return str3;


case 2:


return str1;

case 3:




return str2;
default:
return "known";}
}
void getaddress(int ptr, int * ptr3){
for (int i=0;i<4;i++){
ptr3=(int*)(ptr+4*i);
printf("%s =%p, * in hex =%08X, * in dec =%08d\n",get(i), ptr3, *ptr3, *ptr3);
}
printf("\n");

}

int main(void){

int i=0,a,b;
int *ptr1, *ptr2,*ptr3;
int ptr = (int)&ptr2;
printf("&i=%p\n",&i);
printf("&a=%p\n",&a);
printf("&b=%p\n",&b);
printf("&ptr1=%p\n",&ptr1);
printf("&ptr2=%p\n",&ptr2);
getaddress(ptr, ptr3);

a=5,b=10;

printf("a=5,b=10;\n");
getaddress(ptr, ptr3);

ptr1 = &a; ptr2 = &b;

printf("ptr1 = &a; ptr2 = &b;\n");
getaddress(ptr, ptr3);

*ptr1=7; *ptr2=32; //a=7, b=32

printf("*ptr1=7; *ptr2=32;\n");
getaddress(ptr, ptr3);

a=17;  //a=17, b=32

printf("a=17;\n");
getaddress(ptr, ptr3);

ptr1=ptr2; //ptr1=&b

printf("ptr1=ptr2;\n");
getaddress(ptr, ptr3);

*ptr1=9; //b=9, a=17

printf("*ptr1=9;\n");
getaddress(ptr, ptr3);

ptr1=&a; //ptr1=&a

printf("ptr2=&a;\n");
getaddress(ptr, ptr3);

a=64; //a=64, b=9, ptr1=&a, ptr2=&b

printf("ptr2=&a;\n");
getaddress(ptr, ptr3);

*ptr2=*ptr1+5; // b=a+5=64+5=69

printf("ptr2=&a;\n");
getaddress(ptr, ptr3);

ptr2=&a; //ptr2=&a, ptr1=&a

printf("ptr2=&a;\n");
getaddress(ptr, ptr3);

printf("a=%2d, b=%2d, *ptr1=%2d, *ptr2=%2d\n", a, b, *ptr1, *ptr2);
printf(" ptr1=%p, ptr2=%p\n", ptr1, ptr2);
printf(" ptr1=%p, &*ptr1=%p\n", ptr1, &*ptr1);
ptr1=(int*)0x28FEA0;
printf(" ptr1=%p, *ptr1=%d\n", ptr1, *ptr1);



system("pause");
return 0;

}

結果

&i=0028FEB4
&a=0028FEB0
&b=0028FEAC
&ptr1=0028FEA8
&ptr2=0028FEA4
ptr2 =0028FEA4, * in hex =00405000, * in dec =04214784
ptr1 =0028FEA8, * in hex =0028FEC8, * in dec =02686664
b    =0028FEAC, * in hex =004021DB, * in dec =04202971
a    =0028FEB0, * in hex =00402180, * in dec =04202880

a=5,b=10;
ptr2 =0028FEA4, * in hex =00405000, * in dec =04214784
ptr1 =0028FEA8, * in hex =0028FEC8, * in dec =02686664
b    =0028FEAC, * in hex =0000000A, * in dec =00000010
a    =0028FEB0, * in hex =00000005, * in dec =00000005

ptr1 = &a; ptr2 = &b;
ptr2 =0028FEA4, * in hex =0028FEAC, * in dec =02686636
ptr1 =0028FEA8, * in hex =0028FEB0, * in dec =02686640
b    =0028FEAC, * in hex =0000000A, * in dec =00000010
a    =0028FEB0, * in hex =00000005, * in dec =00000005

*ptr1=7; *ptr2=32;
ptr2 =0028FEA4, * in hex =0028FEAC, * in dec =02686636
ptr1 =0028FEA8, * in hex =0028FEB0, * in dec =02686640
b    =0028FEAC, * in hex =00000020, * in dec =00000032
a    =0028FEB0, * in hex =00000007, * in dec =00000007

a=17;
ptr2 =0028FEA4, * in hex =0028FEAC, * in dec =02686636
ptr1 =0028FEA8, * in hex =0028FEB0, * in dec =02686640
b    =0028FEAC, * in hex =00000020, * in dec =00000032
a    =0028FEB0, * in hex =00000011, * in dec =00000017

ptr1=ptr2;
ptr2 =0028FEA4, * in hex =0028FEAC, * in dec =02686636
ptr1 =0028FEA8, * in hex =0028FEAC, * in dec =02686636
b    =0028FEAC, * in hex =00000020, * in dec =00000032
a    =0028FEB0, * in hex =00000011, * in dec =00000017

*ptr1=9;
ptr2 =0028FEA4, * in hex =0028FEAC, * in dec =02686636
ptr1 =0028FEA8, * in hex =0028FEAC, * in dec =02686636
b    =0028FEAC, * in hex =00000009, * in dec =00000009
a    =0028FEB0, * in hex =00000011, * in dec =00000017

ptr2=&a;
ptr2 =0028FEA4, * in hex =0028FEAC, * in dec =02686636
ptr1 =0028FEA8, * in hex =0028FEB0, * in dec =02686640
b    =0028FEAC, * in hex =00000009, * in dec =00000009
a    =0028FEB0, * in hex =00000011, * in dec =00000017

ptr2=&a;
ptr2 =0028FEA4, * in hex =0028FEAC, * in dec =02686636
ptr1 =0028FEA8, * in hex =0028FEB0, * in dec =02686640
b    =0028FEAC, * in hex =00000009, * in dec =00000009
a    =0028FEB0, * in hex =00000040, * in dec =00000064

ptr2=&a;
ptr2 =0028FEA4, * in hex =0028FEAC, * in dec =02686636
ptr1 =0028FEA8, * in hex =0028FEB0, * in dec =02686640
b    =0028FEAC, * in hex =00000045, * in dec =00000069
a    =0028FEB0, * in hex =00000040, * in dec =00000064

ptr2=&a;
ptr2 =0028FEA4, * in hex =0028FEB0, * in dec =02686640
ptr1 =0028FEA8, * in hex =0028FEB0, * in dec =02686640
b    =0028FEAC, * in hex =00000045, * in dec =00000069
a    =0028FEB0, * in hex =00000040, * in dec =00000064

a=64, b=69, *ptr1=64, *ptr2=64
 ptr1=0028FEB0, ptr2=0028FEB0
 ptr1=0028FEB0, &*ptr1=0028FEB0
 ptr1=0028FEA0, *ptr1=48
請按任意鍵繼續 . . .

用十分鐘瞭解 Tensorflow.js (Google的JavaScript深度學習套件)

https://www.slideshare.net/ccckmit/tensorflowjs-googlejavascript

https://drive.google.com/file/d/1btc1B1PaYEuvypkinA_8WuGeG_lmXMXd/view?usp=sharing

2018年4月25日 星期三

Solidworks教學 | STL檔案轉入教學





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  
  }  
 }