chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫(xiě)文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

如何訓(xùn)練Wekinator控制Arduino

454398 ? 來(lái)源:工程師吳畏 ? 2019-07-31 09:00 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

電路圖

Arduino的引腳11連接到橙色LED的正極引線,通過(guò)220歐姆電阻將LED的負(fù)極引線連接到Arduino的地。類(lèi)似地,通過(guò)220歐姆電阻將白色LED的正極引線連接到Arduino的引腳10和LED的負(fù)極引線連接到Arduino。

如何訓(xùn)練Wekinator控制Arduino

程序入門(mén)

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

之后,打開(kāi)Wekinator并將輸入更改為1并輸出為2并離開(kāi)另一個(gè)選項(xiàng)。

點(diǎn)擊“下一步”,會(huì)出現(xiàn)一個(gè)新窗口?,F(xiàn)在從處理的輸入窗口,單擊橙色框,在Wekinator中,在輸出-1框中輸入1,然后開(kāi)始錄制半秒。

現(xiàn)在,單擊處理中的白色框,在Wekinator中,在輸出-1框中輸入0并在輸出-2框中輸入1并開(kāi)始記錄半秒。

現(xiàn)在點(diǎn)擊“Train”,然后點(diǎn)擊“Run”?,F(xiàn)在,當(dāng)您點(diǎn)擊橙色框時(shí),連接到引腳11的LED將亮起,當(dāng)您單擊白色框時(shí),連接到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

}

聲明:本文內(nèi)容及配圖由入駐作者撰寫(xiě)或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • Arduino
    +關(guān)注

    關(guān)注

    190

    文章

    6498

    瀏覽量

    192205
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評(píng)論

    相關(guān)推薦
    熱點(diǎn)推薦

    使用 ai cude 里面自帶的案例訓(xùn)練UI顯示異常的原因?怎么解決?

    案例的配置是默認(rèn)的,顯示訓(xùn)練ui更改顯示異常
    發(fā)表于 06-23 06:21

    Arduino與LabVIEW聯(lián)合編程指南

    Arduino編程并與LabVIEW上位機(jī)結(jié)合實(shí)現(xiàn)設(shè)備的遠(yuǎn)程控制與數(shù)據(jù)采集。
    發(fā)表于 06-19 15:54 ?0次下載

    k210在線訓(xùn)練的算法是yolo5嗎?

    k210在線訓(xùn)練的算法是yolo5嗎
    發(fā)表于 06-16 08:25

    OCR識(shí)別訓(xùn)練完成后給的是空壓縮包,為什么?

    OCR識(shí)別 一共弄了26張圖片,都標(biāo)注好了,點(diǎn)擊開(kāi)始訓(xùn)練,顯示訓(xùn)練成功了,也將壓縮包發(fā)到郵箱了,下載下來(lái)后,壓縮包里面是空的 OCR圖片20幾張圖太少了。麻煩您多添加點(diǎn),參考我們的ocr識(shí)別訓(xùn)練數(shù)據(jù)集 請(qǐng)問(wèn)
    發(fā)表于 05-28 06:46

    《ESP32S3 Arduino開(kāi)發(fā)指南》第二章 Arduino基礎(chǔ)知識(shí)

    的發(fā)展,在Arduino出現(xiàn)以前,雖然也有很多公司在推廣一些簡(jiǎn)單易用的可編程控制器,但是由于開(kāi)發(fā)平臺(tái)種類(lèi)繁多,而且使用這些控制器基本上都需要對(duì)電子技術(shù)、數(shù)字邏輯、寄存器等內(nèi)容進(jìn)行多方面的了解和學(xué)習(xí),才能
    發(fā)表于 05-13 09:28

    海思SD3403邊緣計(jì)算AI數(shù)據(jù)訓(xùn)練概述

    AI數(shù)據(jù)訓(xùn)練:基于用戶(hù)特定應(yīng)用場(chǎng)景,用戶(hù)采集照片或視頻,通過(guò)AI數(shù)據(jù)訓(xùn)練工程師**(用戶(hù)公司****員工)** ,進(jìn)行特征標(biāo)定后,將標(biāo)定好的訓(xùn)練樣本,通過(guò)AI訓(xùn)練服務(wù)器,進(jìn)行AI學(xué)習(xí)
    發(fā)表于 04-28 11:11

    華為公布AI模型訓(xùn)練與車(chē)輛控制專(zhuān)利

    近日,華為技術(shù)有限公司在技術(shù)創(chuàng)新領(lǐng)域再次邁出重要一步,其申請(qǐng)的“模型的訓(xùn)練方法、車(chē)輛的控制方法及相關(guān)裝置”專(zhuān)利于2月18日正式公布。這一專(zhuān)利的公布標(biāo)志著華為在人工智能領(lǐng)域的又一重大突破。 據(jù)專(zhuān)利摘要
    的頭像 發(fā)表于 02-20 09:14 ?479次閱讀

    如何使用Arduino實(shí)現(xiàn)CAN總線通信呢

    CAN(Controller Area Network)總線是一種常用于汽車(chē)和工業(yè)控制系統(tǒng)的串行通信協(xié)議,以其高可靠性和實(shí)時(shí)性而聞名。Arduino,作為一種流行的開(kāi)源微控制器平臺(tái),可以通過(guò)附加
    的頭像 發(fā)表于 12-23 09:06 ?1941次閱讀

    HAL庫(kù)在Arduino平臺(tái)上的使用

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

    基于Arduino的串口通信項(xiàng)目

    基于Arduino的串口通信項(xiàng)目涉及多個(gè)方面,包括硬件連接、軟件編程、串口參數(shù)配置等。 一、硬件準(zhǔn)備 Arduino開(kāi)發(fā)板 :確保你有一塊Arduino開(kāi)發(fā)板,如Arduino Uno
    的頭像 發(fā)表于 11-22 09:24 ?2193次閱讀

    stm32與Arduino的比較

    在微控制器的世界里,STM32和Arduino是兩個(gè)經(jīng)常被提及的名字。STM32是一系列由STMicroelectronics生產(chǎn)的高性能微控制器,而Arduino則是一個(gè)開(kāi)源電子原型
    的頭像 發(fā)表于 11-19 15:45 ?4195次閱讀

    如何使用Arduino實(shí)現(xiàn)CAN總線通信

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

    激光打靶射擊訓(xùn)練系統(tǒng) DW-S602提供軍事訓(xùn)練效率

    激光打靶射擊訓(xùn)練系統(tǒng)DW-S602是一套集激光技術(shù)、計(jì)算機(jī)技術(shù)、圖像處理技術(shù)和傳感器技術(shù)于一體的綜合性射擊訓(xùn)練系統(tǒng)。該系統(tǒng)通過(guò)模擬真實(shí)戰(zhàn)場(chǎng)環(huán)境,為訓(xùn)練者提供逼真的射擊體驗(yàn),同時(shí)結(jié)合精確的數(shù)據(jù)
    的頭像 發(fā)表于 11-03 09:54 ?858次閱讀

    什么是協(xié)議分析儀和訓(xùn)練

    協(xié)議分析儀和訓(xùn)練器是兩種不同但相關(guān)的設(shè)備或工具,它們?cè)诰W(wǎng)絡(luò)通信、電子設(shè)計(jì)和測(cè)試等領(lǐng)域發(fā)揮著重要作用。以下是對(duì)這兩種設(shè)備的詳細(xì)解釋?zhuān)阂?、協(xié)議分析儀 定義:協(xié)議分析儀(Protocol Analyzer
    發(fā)表于 10-29 14:33

    電磁干擾訓(xùn)練系統(tǒng)原理是什么

    智慧華盛恒輝電磁干擾訓(xùn)練系統(tǒng)的原理主要基于電磁干擾(EMI)的基本原理,即利用電磁波對(duì)電子設(shè)備或系統(tǒng)產(chǎn)生的干擾,通過(guò)模擬真實(shí)的電磁環(huán)境,對(duì)受訓(xùn)人員進(jìn)行電磁干擾應(yīng)對(duì)能力的訓(xùn)練。以下是電磁干擾訓(xùn)練系統(tǒng)
    的頭像 發(fā)表于 07-22 16:34 ?753次閱讀