arduino

Convert string as hex to hexadecimal

人走茶凉 提交于 2019-12-12 03:28:53
问题 I have a function that takes an uint64_t variable. Normally I would do this: irsend.sendNEC(result.value); result.value is an uint64_t as hexadecimal (I think). If I do this: String((uint32_t) results.value, HEX) I get this: FF02FD If I do: irsend.sendNEC(0x00FF02FD) it works perfectly and is what I want. Instead of grabbing the result.value , I want to write it as a string (because that's what I get from the GET request). How do I make "FF02FD" into 0x00FF02FD ? EDIT: Maybe this makes it

Serial Data communication Arduino

这一生的挚爱 提交于 2019-12-12 03:28:10
问题 I currently am trying to read the serial output from a small capacitance meter(model DN060-02v04 from JYETECH). I have the arduino UNO set up to read the meter output. I do get data, but it is not readable and does not correspond to the format outlined in the manual. My baud rates match at 38400bps. The meter claims a 8-N-1 configuration. I'm using the SerialSoftware example in the Arduino Library to read it. #include <SoftwareSerial.h> SoftwareSerial mySerial(2, 3); // RX, TX void setup() {

How can I set the range for Xbox One controller Triggers using Pygame?

戏子无情 提交于 2019-12-12 03:20:03
问题 I am using Pygame 1.9.2 with Python 3.4 to create a control program for a robot. The controller is a new Xbox One controller connected via USB which is working fine with pygame. The problem is that the trigger buttons are considered Axes which give values from -1 to 1 depending on how hard you press. Is there a way to change this to a range from 0 to 1 or any other range that does not include negative numbers? Thanks 回答1: (x + 1.0) / 2.0 where x is whatever you get from the controller should

Arduino mega + esp 8266 sending get request

别来无恙 提交于 2019-12-12 02:43:16
问题 i have a php script which help to store data into google firebase. i am using this url to access my php scipt and input the data: arduino.byethost22.com/FirebaseTest.php?slot1_data=empty&slot2_data=occupied i have tried it and it is able to store slot1_data as empty and slot2_data as occupied. However i need to use arduino to send this url. i am using this code currently #include "SoftwareSerial.h" #define DEBUG false // turn debug message on or off in serial String server = "arduino

pyserial communication with arduino (for motor-control)

删除回忆录丶 提交于 2019-12-12 02:42:14
问题 I would like to send data from python do arduino in order to control motors via relays. Idea is to send a number, in order to identify a motor and a value, to finally move it. Unfortunately im struggling with some problems. Data is getting lost. So, in this minimal example there is an identifier "n", to indicate that the received data is the variable "number" and an identifier "c" to identify that the received data is a counter. To find out what's wrong, I send the data back to Python and try

arduino python interface with multiple variables

眉间皱痕 提交于 2019-12-12 02:39:45
问题 I want to bring 3 sensor variables that change all the time to my python interface. I am trying with this test code, it does not work, what am I doing wrong? Arduino: void setup() { Serial.begin (9600); } void loop() { Serial.print(random(1,3)); Serial.print(random(3,5)); Serial.print(random(5,7)); } Python: canvas.create_text(190, 150, text=ser.readline(1), fill="gray", font="Helvetica 45 bold",tag="T1") How can I get multiple variables updating all the time? right now I am just getting the

Settext causing text to flicker irratically

不羁的心 提交于 2019-12-12 02:36:43
问题 I'm making an app which establishes USB communication between an Arduino UNO R3 and an android tablet. Arduino board is sending data correctly and it is even being received by tablet correctly and when tried to display, the text does get printed but with a rather continuous flicker. class MyThread extends Thread { @Override public void run() { mCallback = new UsbSerialInterface.UsbReadCallback() { //Defining a Callback which triggers whenever data is read. @Override public void onReceivedData

Java to Esplora Serial port communication issue

我的梦境 提交于 2019-12-12 02:19:37
问题 I am attempting to communicate between an Arduino Esplora and a Java process using the RXTXComm library that comes bundled with the Arduino IDE. I have started with the code here. Based on this question I have modified my Arduino code to be void setup(){ Serial.begin(9600); while(!Serial); } void loop(){ Serial.println("Test"); } Communication consistently works with an Arduino UNO. However, Communication with an Arduino Esplora often produces no output, and when it does work, it quickly

SocketIO server not sending data to Arduino

旧城冷巷雨未停 提交于 2019-12-12 02:18:13
问题 I have an Arduino TCP connection that sends data to my server using socketIO. Everything works great. I'm trying to send data to tigger some events. I got char c = client.read() function on my Arduino sketch to listen for incoming data but unfortunately I don't receive anything. I'm running all my connections on one port. HTTP/TCP i.e my Arduino forwards data on port 3000 and my webpage also uses this port. Could this be a problem? server.js var app = express(); var server = require('http')

Linux Serial Port: missing data on input

蹲街弑〆低调 提交于 2019-12-12 02:17:23
问题 #include <fcntl.h> #include <termios.h> #include <unistd.h> #include <errno.h> #include <cerrno> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fstream> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <cstdlib> #include <ctime> using namespace std; typedef struct termios ComSet; int main() { int acm=-1; acm=open("/dev/ttyACM0",O_RDWR | O_NOCTTY); if(acm == -1) { cout<<"Error Opening ttyACM0"<<endl; exit(1); } else {