用ESP32 PWM實現LED漸漸亮起。

程式的部分主要分成三個:1.設定頻道LEDchannel、2.附加到PIN腳、3.決議輸出巨細。

1.設定頻道LEDchannel屬性

ledcSetup(LEDChannel, freq, resolution);
//LEDChannel設定為0,分歧輸出要設定到分歧頻道,例如RGB LED就要開三個頻道分別治理R、G、B
//freq輸出頻率,建議值5000 Hz
//resolution代表輸出解析度,例如8代表0-255,10代表0-1023

2.附加到PIN腳

ledcAttachPin(ledPin, LEDChannel);
//ledPin代表腳位,看你把裝備接在哪一個腳位上面
//LEDchannel代表步調1所宣佈的LEDchannel,也就是說把設定好的LEDchannel屬性附加到某個腳位上

3.決意輸出巨細。

ledcWrite(LEDChannel, dutyCycle);
//將LEDchannel輸出dutyCycle的值。

範例程式將使接在Pin16的LED逐步亮起並熄滅,類型複製於 https://randomnerdtutorials.com/esp32-pwm-arduino-ide/

Arduino ESP32 PWM輸出 讓LED漸亮漸暗 網
Arduino ESP32 PWM輸出 讓LED漸亮漸暗 網

  1. // the number of the LED pin
  2. const int ledPin = 16;  // 16 corresponds to GPIO16
  3.  
  4. // setting PWM properties
  5. const int freq = 5000;
  6. const int ledChannel = 0;
  7. const int resolution = 8;
  8.  
  9. void setup(){
  10.   // configure LED PWM functionalitites
  11.   ledcSetup(ledChannel, freq, resolution);
  12.   
  13.   // attach the channel to the GPIO to be controlled
  14.   ledcAttachPin(ledPin, ledChannel);
  15. }
  16.  
  17. void loop(){
  18.   // increase the LED brightness
  19.   for(int dutyCycle = 0; dutyCycle <= 255; dutyCycle++){   
  20.     // changing the LED brightness with PWM
  21.     ledcWrite(ledChannel, dutyCycle);
  22.     delay(15);
  23.   }
  24.  
  25.   // decrease the LED brightness
  26.   for(int dutyCycle = 255; dutyCycle >= 0; dutyCycle--){
  27.     // changing the LED brightness with PWM
  28.     ledcWrite(ledChannel, dutyCycle);   
  29.     delay(15);
  30.   }
  31. }
文章標籤

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

網站架設jQuery 輪播式告白插件 flexslider 利用指南

展現網站
jQuery 輪播式告白插件 flexslider 利用指南

發現了個不錯的jQuery幻燈片插件flexslider,有接近3000 Star,應當說是很靠譜的,下面是簡單利用教程。

引入代碼

所有代碼都可以在flexlslider的Github上取得。

引入css 文件和js 文件和jQuery 焦點代碼:

文章標籤

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

前兩天收到中華電信HINET的德律風
說某一網域被入侵,亂發信被揭發
今天客戶說寄到GMAIL的信全數寄不出去
查了一下,先到下面網址打入IPhttps://mxtoolbox.com
https://www.dnsbl.info/dnsbl-details.php?dnsbl=dnsbl.spfbl.net
伺服器被當垃圾信跳板 申請DNS IP反解

發現有被兩個單位列入黑名單
伺服器被當垃圾信跳板 申請DNS IP反解


問了谷歌後,只要在其他dnsbl或是CBL裡沒有記載就好

直接問中華電信的 "Spam小組" 有專線(02)2192-6022 直接打去問,完全都免費。
CBL:http://cbl.abuseat.org/lookup.cgi?ip=61.218.3.178&.submit=Lookup
文章標籤

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

網站架設
實例需求:應用python說話爬取http://kaijiang.zhcw.com/zhcw/html/ssq/list_1.html這個開獎網站所有的信息,並且留存為txt文件和excel文件。
實例情況:python3.7
       BeautifulSoup庫、xlwt庫(需手動安裝)
       urllib庫、re庫(內置的python庫,無需手動安裝)
文章標籤

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

網站架設

結果圖:
Yolov8 照片偵測後如何抓物體座標位置

座標:

  1. [[ 16 290]
  2. [412 491]
  3. [740 626]
  4. [283 631]
  5. [146 651]
  6. [ 32 710]]
  7. 5.0
  8. image 1/1 D:\yolo\bus.jpg: 640x480 4 persons, 1 bus, 1 stop sign, 83.9ms
  9. Speed: 3.0ms preprocess, 83.9ms inference, 4.0ms postprocess per image at shape (1, 3, 640, 480)
  10. tensor([[ 22.3412, 228.0822, 802.0841, 754.3939]], device='cuda:0')
  11. 準確率 0.879738450050354
  12. x,y: [[412 491]]
  13. 0.0
  14. tensor([[ 47.5999, 398.8344, 244.2552, 903.1386]], device='cuda:0')
  15. 準確率 0.873720109462738
  16. x,y: [[146 651]]
  17. 0.0
  18. tensor([[670.3670, 376.9174, 810.0000, 875.0829]], device='cuda:0')
  19. 準確率 0.8693700432777405
  20. x,y: [[740 626]]
  21. 0.0
  22. tensor([[220.5713, 405.7240, 344.5589, 857.2506]], device='cuda:0')
  23. 準確率 0.819391667842865
  24. x,y: [[283 631]]
  25. 11.0
  26. tensor([[7.7698e-02, 2.5441e+02, 3.2119e+01, 3.2465e+02]], device='cuda:0')
  27. 準確率 0.44594067335128784
  28. x,y: [[ 16 290]]
  29. 0.0
  30. tensor([[3.2650e-02, 5.4988e+02, 6.4001e+01, 8.6930e+02]], device='cuda:0')
  31. 準確率 0.29976797103881836
  32. x,y: [[ 32 710]]
  33.  
文章標籤

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

紀錄一下批量抓取 Google 搜尋結果裡的保持的方法。


假如還沒有安裝以下,要先下載安裝:
 

  1. pip install beautifulsoup4
  2. pip install google
文章標籤

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

網站架設

官方文件鏈結 https://docs.ultralytics.com/models/

程式碼

  1. from ultralytics import YOLO
  2. import os
  3. os.environ["KMP_DUPLICATE_LIB_OK"]  =  "TRUE"
  4.  
  5. if __name__ == '__main__':
  6.     # Load a COCO-pretrained YOLOv8n model
  7.     model = YOLO('yolov8n.pt')
  8.  
  9.     # Display model information (optional)
  10.     model.info()
  11.  
  12.     # Train the model on the COCO8 example dataset for 100 epochs
  13.     results = model.train(data='coco8.yaml', epochs=100, imgsz=640)
  14.  
  15.     # Run inference with the YOLOv8n model on the 'bus.jpg' image
  16.     results = model('bus.jpg')
文章標籤

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

前台看到 相關商品

opencart 相關商品(Related Products

文章標籤

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

近從新調試一段pytorch 程式碼,以前的伺服器上完全沒問題,但換了一台機械,重新安裝了新版本的cuda, anaconda ,pytorch 等,之前的程式碼泛起各類版本不合適的問題。
問題:
目前說說這個問題。運行pytorch 時出現的情況如下:

  1. RuntimeError:
  2.         An attempt has been made to start a new process before the
  3.         current process has finished its bootstrapping phase.
  4.  
  5.         This probably means that you are not using fork to start your
  6.         child processes and you have forgotten to use the proper idiom
  7.         in the main module:
  8.  
  9.             if __name__ == '__main__':
  10.                 freeze_support()
  11.                 ...
  12.  
  13.         The "freeze_support()" line can be omitted if the program
  14.         is not going to be frozen to produce an executable.
文章標籤

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

網站架設

用nmcli可以成功確立pppoe連線
: (鄙人列例子中,我將pppoe連線定名為ppp0,刻意設定為需要時才手動進行撥接,
: 網卡的裝配名稱為對外enp1s0f0, 對內enp1s0f1)
1. 安裝模組 NetworkManager-ppp ppp
enp1s0f0設定IP:192.168.0.254
enp1s0f0設定IP:192.168.1.254

1.安裝模組

  1. dnf install NetworkManager-ppp -y
  2. dnf install ppp -y
文章標籤

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