文章出處:網頁設計,網站架設 ,網路行銷,網頁優化,SEO - NetYea 網頁設計

學會Arduino根基操控後
一定會想學會無線遙控,如藍芽Bluetooth, Wifi
這篇申明藍芽Bluetooth操控

成績圖
網站架設 若何用藍芽Bluetooth連線節制 Arduin


影片


代碼:

文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()

  1. cPs# lsof -iTCP:25 -sTCP:LISTEN
  2. cPs# /scripts/restartsrv_exim --status
  3. (XID 3ufkqb) The “exim” service is down.
複製代碼
文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()

網站架設

用jquery做相册

典範圖片
用jquery做相册


CSS
  1. body{ text-align:center;}
  2. *{ margin:0; padding:0;}
  3. img{ border:none;}
  4. #container{ width:900px; height:900px; background:#000000; border:1px solid #006633; margin:auto; padding:0;}
  5. #loader{ width:480px; margin:auto; height:500px; background:#FFFFFF; float:left; margin-right:5px;}
  6. #imageOptions{ float:left;}
  7. #imageOptions li{ list-style:none; margin:10px;}
  8. .loading{ background:url(images/spinner.gif) center center no-repeat;}
  9. h3{ line-height:500px;}
文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()

  1. $results = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
複製代碼
文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()

資料庫常常是有看沒有懂

圖解秒懂SQL說話

SQL利害的圖解

文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()


 

background-size:cover
 

文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()

網站架設

如何用 Cpanel 整機複製之前那一台的網站及設定

進入CPANEL ROOT後台

拔取Transfer Tool
Remote Server Address:
輸入原主機的IP


選取 ROOT帳號


輸入暗碼


鄙人一步設定便可

文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()

 

 

文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()

網站架設

網站架設 Arduino的 RGB led燈(共陽極)的利用
網站架設 Arduino的 RGB led燈(共陽極)的利用
RGB LED的R接Arduino GPIO腳位16。
RGB LED的G接Arduino GPIO腳位17。
RGB LED的B接Arduino GPIO腳位5。

程式碼
1.每隔一秒改變LED的色彩,紅、綠、藍、黃、青、洋紅、白


 

RGB LED依序為紅、最長腳、
RGB LED的共陽極(最長腳)串接一個330的電阻後再接地(GND)。

文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()

Android手機若何用Arduino藍芽連線ESP32控制

  1. // Include necessary libraries
  2. #include <BLEDevice.h>
  3. #include <BLEServer.h>
  4. #include <BLEUtils.h>
  5.  
  6. // 界說 UUIDs (注意要與App Inventor內容對應)
  7. #define SERVICE_UUID            "C6FBDD3C-7123-4C9E-86AB-005F1A7EDA01"
  8. #define CHARACTERISTIC_UUID_RX  "B88E098B-E464-4B54-B827-79EB2B150A9F"
  9. #define CHARACTERISTIC_UUID_TX  "D769FACF-A4DA-47BA-9253-65359EE480FB"
  10.  
  11. String BLE_Code;
  12. BLECharacteristic *pCharacteristic;
  13. bool deviceConnected = false;
  14.  
  15. int directState = 0; // 動作
  16. int speed_c = 192;
  17. // PWM, INA, INB 與LED接腳變數
  18. int PWMA = 13;
  19. int INA1 = 12;
  20. int INA2 = 14;
  21. int STBY = 27;
  22. int INB1 = 25;
  23. int INB2 = 26;
  24. int PWMB = 33;
  25. const int ledPin = 2;
  26.  
  27. const int freq = 10000;
  28. const int resolution = 8;
  29.  
  30.  
  31.  
  32. // 設定 callbacks onConnect & onDisconnect函數
  33. class MyServerCallbacks: public BLEServerCallbacks {
  34.   void onConnect(BLEServer* pServer) {
  35.     deviceConnected = true;
  36.   };
  37.   void onDisconnect(BLEServer* pServer) {
  38.     deviceConnected = false;
  39.   }
  40. };
  41.  
  42. // 設定 callback function 當收到新的資訊 (from the Android application)
  43. class MyCallbacks: public BLECharacteristicCallbacks {
  44.   void onWrite(BLECharacteristic *pCharacteristic) {
  45.     std::string rxValue = pCharacteristic->getValue();
  46.     BLE_Code="";
  47.     if(rxValue.length() > 0) {
  48.       Serial.print("領受資料為 : ");
  49.       for(int i = 0; i < rxValue.length(); i++) {
  50.         BLE_Code+=rxValue[i];
  51.         Serial.print(rxValue[i]);
  52.       }
  53.       Serial.println();
  54.       BLE_Code.toUpperCase();
  55.       Serial.println(BLE_Code);
  56.         if(BLE_Code.indexOf("GO")!=-1)
  57.         {
  58.           Serial.println("GO");
  59.           directState=1;
  60.         } else if(BLE_Code.indexOf("BACK")!=-1) {
  61.           Serial.println("BACK");
  62.           directState=2;
  63.         } else if(BLE_Code.indexOf("LEFT")!=-1) {
  64.           Serial.println("LEFT");
  65.           directState=3;
  66.         } else if(BLE_Code.indexOf("RIGHT")!=-1) {
  67.           Serial.println("RIGHT");
  68.           directState=4;
  69.         } else if(BLE_Code.indexOf("RELEASE")!=-1) {
  70.           Serial.println("RELEASE");
  71.           directState=5;
  72.         }
  73.         if(BLE_Code.indexOf("192")!=-1)
  74.         {
  75.           speed_c=192;
  76.         } else if(BLE_Code.indexOf("255")!=-1) {
  77.           speed_c=255;
  78.         }
  79.     }
  80.   }
  81. };
  82.  
  83. void setup() {
  84.   Serial.begin(115200);
  85.   pinMode(ledPin, OUTPUT); //設定腳位為輸出
  86.   pinMode(INA1,OUTPUT);
  87.   pinMode(INA2,OUTPUT);
  88.   pinMode(PWMA,OUTPUT);
  89.   pinMode(STBY,OUTPUT);
  90.   pinMode(INB1,OUTPUT);
  91.   pinMode(INB2,OUTPUT);
  92.   pinMode(PWMB,OUTPUT);
  93.   //digital output test
  94.   digitalWrite(INA1,HIGH); //設定腳位HIGH LOW
  95.   digitalWrite(INA2,LOW);
  96.   digitalWrite(PWMA,LOW);
  97.   digitalWrite(STBY,HIGH);
  98.   digitalWrite(INB1,HIGH);
  99.   digitalWrite(INB2,LOW);
  100.   digitalWrite(PWMB,LOW);
  101.   delay(1000);
  102.  
  103.   //analog output(PWM) test 設定LED Channel PWM 頻率
  104.   ledcSetup(0, freq, resolution);
  105.   ledcSetup(1, freq, resolution);
  106.   ledcSetup(2, freq, resolution);
  107.   ledcSetup(3, freq, resolution);
  108.   ledcSetup(4, freq, resolution);
  109.   ledcSetup(5, freq, resolution);
  110.   ledcSetup(6, freq, resolution);
  111.   //設定腳位Channel
  112.   ledcAttachPin(INA1, 0);
  113.   ledcAttachPin(INA2, 1);
  114.   ledcAttachPin(PWMA, 2);
  115.   ledcAttachPin(STBY, 3);
  116.   ledcAttachPin(INB1, 4);
  117.   ledcAttachPin(INB2, 5);
  118.   ledcAttachPin(PWMB, 6);
  119.   
  120.   // 創立BLE Device
  121.   BLEDevice::init("ESP32_WeMos1");
  122.  
  123.   // 設立建設BLE Server
  124.   BLEServer *pServer = BLEDevice::createServer();
  125.   pServer->setCallbacks(new MyServerCallbacks());
  126.  
  127.   // 建樹BLE Service
  128.   BLEService *pService = pServer->createService(SERVICE_UUID);
  129.  
  130.   // 建立BLE Characteristic
  131.   pCharacteristic = pService->createCharacteristic(
  132.                       CHARACTERISTIC_UUID_TX,
  133.                       BLECharacteristic::PROPERTY_NOTIFY);                     
  134. //  pCharacteristic->addDescriptor(new BLE2902());
  135.   BLECharacteristic *pCharacteristic = pService->createCharacteristic(
  136.                                          CHARACTERISTIC_UUID_RX,
  137.                                          BLECharacteristic::PROPERTY_WRITE);
  138. pCharacteristic->setCallbacks(new MyCallbacks());
  139.  
  140.   // 最先(起)service
  141.   pService->start();
  142.  
  143.   // 起頭(起)advertising
  144.   pServer->getAdvertising()->start();
  145.   Serial.println("期待BLE手機連線....");
  146.   
  147.   digitalWrite(ledPin,LOW);
  148.   delay(500);
  149.   digitalWrite(ledPin,HIGH);
  150.   delay(500);
  151.   digitalWrite(ledPin,LOW);
  152. }
  153.  
  154. void loop() {
  155.     // Check received message and control output accordingly
  156.     if (directState==1){
  157.         move(speed_c, 1); // full speed, go
  158.         Serial.println("進步");
  159.     } else if(directState==2) {
  160.         move(speed_c, 2); // full speed, down
  161.         Serial.println("撤退退卻");
  162.     } else if(directState==3) {
  163.         move(speed_c, 3); // full speed, left
  164.         Serial.println("左轉");
  165.     } else if(directState==4) {
  166.         move(speed_c, 4); // full speed, right
  167.         Serial.println("右轉");
  168.     } else if(directState==5) {
  169.       stop(); //stop
  170.       Serial.println("stop");
  171.     }
  172.   delay(100); //go for 1 second
  173. }
  174.  
  175. void move( int speed, int direction){
  176. //Move specific motor at speed and direction
  177. //speed: 0 is off, and 255 is full speed
  178. //direction: 0 clockwise, 1 counter-clockwise
  179.  
  180.   ledcWrite(3, 255); //STBY disable standby
  181.   Serial.println(direction);
  182.   if(direction == 1){
  183.     //設定馬達1為正轉
  184.     ledcWrite(0, 255); //INA1
  185.     ledcWrite(1, 0);   //INA2
  186.     ledcWrite(2, speed);   //PWMA
  187.     //設定馬達2為正轉
  188.     ledcWrite(4, 255); //INB1
  189.     ledcWrite(5, 0); //INB2
  190.     ledcWrite(6, speed);   //PWMB
  191.     digitalWrite(ledPin,HIGH);
  192.     delay(500);
  193.     digitalWrite(ledPin,LOW);
  194.   } else if (direction == 2){
  195.     //設定馬達1為反轉
  196.     ledcWrite(0, 0);   //INA1
  197.     ledcWrite(1, 255); //INA2
  198.     ledcWrite(2, speed);   //PWMA
  199.     //設定馬達2為反轉
  200.     ledcWrite(4, 0);   //INB1
  201.     ledcWrite(5, 255); //INB2
  202.     ledcWrite(6, speed);   //PWMB
  203.     digitalWrite(ledPin,HIGH);
  204.     delay(500);
  205.     digitalWrite(ledPin,LOW);
  206.   } else if (direction == 3){
  207.     //設定馬達1為正轉
  208.     ledcWrite(0, 255); //INA1
  209.     ledcWrite(1, 0);   //INA2
  210.     ledcWrite(2, speed);   //PWMA
  211.     //設定馬達2為反轉
  212.     ledcWrite(4, 0);   //INB1
  213.     ledcWrite(5, 255); //INB2
  214.     ledcWrite(6, speed);   //PWMB
  215.     digitalWrite(ledPin,HIGH);
  216.     delay(500);
  217.     digitalWrite(ledPin,LOW);
  218.   } else if (direction == 4){
  219.     //設定馬達1為反轉
  220.     ledcWrite(0, 0);   //INA1
  221.     ledcWrite(1, 255); //INA2
  222.     ledcWrite(2, speed);   //PWMA
  223.     //設定馬達2為正轉
  224.     ledcWrite(4, 255); //INB1
  225.     ledcWrite(5, 0); //INB2
  226.     ledcWrite(6, speed);   //PWMB
  227.     digitalWrite(ledPin,HIGH);
  228.     delay(500);
  229.     digitalWrite(ledPin,LOW);
  230.   }
  231.   Serial.println(speed);
  232. }
  233.  
  234. void stop(){
  235. //enable standby  
  236.   ledcWrite(3, 0); //STBY enable standby
  237.   //Serial.println("stop");
  238. }
文章標籤

hallk6k22ej 發表在 痞客邦 留言(0) 人氣()