女人自慰AV免费观看内涵网,日韩国产剧情在线观看网址,神马电影网特片网,最新一级电影欧美,在线观看亚洲欧美日韩,黄色视频在线播放免费观看,ABO涨奶期羡澄,第一导航fulione,美女主播操b

0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

如何訓練Wekinator控制Arduino

454398 ? 來源:工程師吳畏 ? 2019-07-31 09:00 ? 次閱讀

電路圖

Arduino的引腳11連接到橙色LED的正極引線,通過220歐姆電阻將LED的負極引線連接到Arduino的地。類似地,通過220歐姆電阻將白色LED的正極引線連接到Arduino的引腳10和LED的負極引線連接到Arduino。

如何訓練Wekinator控制Arduino

程序入門

首先,在Arduino IDE中加載下面為Arduino提供的代碼。然后上傳給定代碼以在IDE中處理。

之后,打開Wekinator并將輸入更改為1并輸出為2并離開另一個選項。

點擊“下一步”,會出現一個新窗口。現在從處理的輸入窗口,單擊橙色框,在Wekinator中,在輸出-1框中輸入1,然后開始錄制半秒。

現在,單擊處理中的白色框,在Wekinator中,在輸出-1框中輸入0并在輸出-2框中輸入1并開始記錄半秒。

現在點擊“Train”,然后點擊“Run”。現在,當您點擊橙色框時,連接到引腳11的LED將亮起,當您單擊白色框時,連接到Arduino引腳10的LED將亮起。

Arduino代碼

代碼用注釋解釋。

#include //Including the library that will help us in receiving and sending the values from processing

ValueReceiver《2》 receiver; /*Creating the receiver that will receive up to 2 values.

Put the number of values to synchronize in the brackets */

/* The below two variables will be synchronized in the processing

and they should be same on both sides. */

int output;

int output1;

// Initializing the pins for led‘s

int orange_led = 11;

int white_led = 10;

void setup()

{

/* Starting the serial communication because we are communicating with the

Arduino through serial. The baudrate should be same as on the processing side. */

Serial.begin(19200);

pinMode(white_led, OUTPUT);

pinMode(orange_led, OUTPUT);

// Synchronizing the variables with the processing. The variables must be int type.

receiver.observe(output);

receiver.observe(output1);

}

void loop()

{

// Receiving the output from the processing.

receiver.sync();

// Matching the received output to light up led’s

if (output == 1)

{

digitalWrite(orange_led, HIGH);

}

else if (output == 0)

{

digitalWrite(orange_led, LOW);

}

if (output1 == 1)

{

digitalWrite(white_led, HIGH);

}

else if(output1 == 0)

{

digitalWrite(white_led, LOW);

}

}

處理代碼(輸入到Wekinator)

// Importing the library which will help us in communicating with the wekinator

import oscP5.*;

import netP5.*;

//creating the instances

OscP5 oscP5;

NetAddress dest;

float bx;

void setup() {

// Size of output window

size(400, 100, P3D);

// Starting the communication with wekinator. listen on port 9000, return messages on port 6448

oscP5 = new OscP5(this,9000);

dest = new NetAddress(“127.0.0.1”,6448);

}

void draw() {

// Creating the boxes in window

blocks();

// Send the OSC message to wekinator

sendOsc();

}

void mousePressed()

{

if (mouseX 》 25 && mouseX 《 75)

{

bx=1;

}

if (mouseX 》 325 && mouseX 《 375)

{

bx=2;

}

}

void sendOsc() {

OscMessage msg = new OscMessage(“/wek/inputs”);

msg.add((float)bx);

oscP5.send(msg, dest);

}

void blocks()

{

background(0);

fill(255, 155, 0);

rect(25, 25, 50, 50);

fill(255, 255, 255);

rect(325, 25, 50, 50);

}

處理代碼(Wekinator的輸出)

import vsync.*; // Importing the library that will help us in sending and receiving the values from the Arduino

import processing.serial.*; // Importing the serial library

// Below libraries will connect and send, receive the values from wekinator

import oscP5.*;

import netP5.*;

// Creating the instances

OscP5 oscP5;

NetAddress dest;

ValueSender sender;

// These variables will be syncronized with the Arduino and they should be same on the Arduino side.

public int output;

public int output1;

void setup()

{

// Starting the serial communication, the baudrate and the com port should be same as on the Arduino side.

Serial serial = new Serial(this, “COM10”, 19200);

sender = new ValueSender(this, serial);

// Synchronizing the variables as on the Arduino side. The order should be same.

sender.observe(“output”);

sender.observe(“output1”);

// Starting the communication with wekinator. listen on port 12000, return messages on port 6448

oscP5 = new OscP5(this, 12000);

dest = new NetAddress(“127.0.0.1”, 6448);

}

// Recieve OSC messages from Wekinator

void oscEvent(OscMessage theOscMessage) {

if (theOscMessage.checkAddrPattern(“/wek/outputs”) == true) {

// Receiving the output from wekinator

float value = theOscMessage.get(0).floatValue(); // First output

float value1 = theOscMessage.get(1).floatValue(); // Second output

// Converting the output to int type

output = int(value);

output1 = int(value1);

}

}

void draw()

{

// Nothing to be drawn for this example

}

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。 舉報投訴
  • Arduino
    +關注

    關注

    188

    文章

    6491

    瀏覽量

    190087
收藏 人收藏

    評論

    相關推薦
    熱點推薦

    OCR識別訓練完成后給的是空壓縮包,為什么?

    OCR識別 一共弄了26張圖片,都標注好了,點擊開始訓練,顯示訓練成功了,也將壓縮包發到郵箱了,下載下來后,壓縮包里面是空的 OCR圖片20幾張圖太少了。麻煩您多添加點,參考我們的ocr識別訓練數據集 請問
    發表于 05-28 06:46

    《ESP32S3 Arduino開發指南》第二章 Arduino基礎知識

    的發展,在Arduino出現以前,雖然也有很多公司在推廣一些簡單易用的可編程控制器,但是由于開發平臺種類繁多,而且使用這些控制器基本上都需要對電子技術、數字邏輯、寄存器等內容進行多方面的了解和學習,才能
    發表于 05-13 09:28

    海思SD3403邊緣計算AI數據訓練概述

    AI數據訓練:基于用戶特定應用場景,用戶采集照片或視頻,通過AI數據訓練工程師**(用戶公司****員工)** ,進行特征標定后,將標定好的訓練樣本,通過AI訓練服務器,進行AI學習
    發表于 04-28 11:11

    華為公布AI模型訓練與車輛控制專利

    近日,華為技術有限公司在技術創新領域再次邁出重要一步,其申請的“模型的訓練方法、車輛的控制方法及相關裝置”專利于2月18日正式公布。這一專利的公布標志著華為在人工智能領域的又一重大突破。 據專利摘要
    的頭像 發表于 02-20 09:14 ?409次閱讀

    如何使用Arduino實現CAN總線通信呢

    CAN(Controller Area Network)總線是一種常用于汽車和工業控制系統的串行通信協議,以其高可靠性和實時性而聞名。Arduino,作為一種流行的開源微控制器平臺,可以通過附加
    的頭像 發表于 12-23 09:06 ?1590次閱讀

    HAL庫在Arduino平臺上的使用

    HAL庫在Arduino平臺上的使用 Arduino平臺是一個開源的電子原型平臺,它包括硬件(基于微控制器的電路板)和軟件(Arduino IDE)。
    的頭像 發表于 12-02 14:04 ?1437次閱讀

    基于Arduino的串口通信項目

    基于Arduino的串口通信項目涉及多個方面,包括硬件連接、軟件編程、串口參數配置等。 一、硬件準備 Arduino開發板 :確保你有一塊Arduino開發板,如Arduino Uno
    的頭像 發表于 11-22 09:24 ?1941次閱讀

    stm32與Arduino的比較

    在微控制器的世界里,STM32和Arduino是兩個經常被提及的名字。STM32是一系列由STMicroelectronics生產的高性能微控制器,而Arduino則是一個開源電子原型
    的頭像 發表于 11-19 15:45 ?3839次閱讀

    如何使用Arduino實現CAN總線通信

    CAN總線(Controller Area Network)是一種多主控制的串行通信協議,廣泛應用于汽車電子、工業自動化等領域。它以其高可靠性、實時性和靈活性而受到青睞。Arduino作為一個
    的頭像 發表于 11-12 10:09 ?2476次閱讀

    激光打靶射擊訓練系統 DW-S602提供軍事訓練效率

    激光打靶射擊訓練系統DW-S602是一套集激光技術、計算機技術、圖像處理技術和傳感器技術于一體的綜合性射擊訓練系統。該系統通過模擬真實戰場環境,為訓練者提供逼真的射擊體驗,同時結合精確的數據
    的頭像 發表于 11-03 09:54 ?751次閱讀

    什么是協議分析儀和訓練

    協議分析儀和訓練器是兩種不同但相關的設備或工具,它們在網絡通信、電子設計和測試等領域發揮著重要作用。以下是對這兩種設備的詳細解釋:一、協議分析儀 定義:協議分析儀(Protocol Analyzer
    發表于 10-29 14:33

    電磁干擾訓練系統原理是什么

    智慧華盛恒輝電磁干擾訓練系統的原理主要基于電磁干擾(EMI)的基本原理,即利用電磁波對電子設備或系統產生的干擾,通過模擬真實的電磁環境,對受訓人員進行電磁干擾應對能力的訓練。以下是電磁干擾訓練系統
    的頭像 發表于 07-22 16:34 ?676次閱讀

    海上電磁干擾訓練系統

    智慧華盛恒輝海上電磁干擾訓練系統是一種專門用于模擬海上電磁環境、訓練人員應對電磁干擾能力的系統。以下是對海上電磁干擾訓練系統的詳細解析: 智慧華盛恒輝系統概述 智慧華盛恒輝海上電磁干擾訓練
    的頭像 發表于 07-15 16:05 ?468次閱讀

    人臉識別模型訓練流程

    人臉識別模型訓練流程是計算機視覺領域中的一項重要技術。本文將詳細介紹人臉識別模型的訓練流程,包括數據準備、模型選擇、模型訓練、模型評估和應用部署等環節。 數據準備 數據是訓練人臉識別模
    的頭像 發表于 07-04 09:19 ?1751次閱讀

    利用Arduino的自動風扇速度控制電路設計

    自動風扇速度控制電路Arduino LM35編程非常容易實驗,可用于根據溫度水平通過繼電器控制任何目標設備。對于這里的溫度測量,我們使用 LM35,這是一種精密集成電路溫度器件,其輸出電壓與攝氏度
    的頭像 發表于 06-22 16:39 ?2916次閱讀
    利用<b class='flag-5'>Arduino</b>的自動風扇速度<b class='flag-5'>控制</b>電路設計