arduino

Blank lines in txt files in Python

混江龙づ霸主 提交于 2021-01-29 16:13:48
问题 I almost finished my project, but there is still one little problem. I want to write sensor values in a txt file with Python. All is working fine but one thing : in the txt file, there're blank lines between each value. It's really annoying because I can't put the values in a spreadsheet. It looks like That: Sensor values: 2 4 6.32 1 etc.... When I want it that way : Sensor values: 1 2 3 5 8 etc... Here's the part of the code concerned : def write_data(): global file_stream now = datetime.now

Exception 28 thrown on ESP8266-01 when connected to Adafruit MQTT and Telegram

孤街醉人 提交于 2021-01-29 14:17:19
问题 The title is quite self-explanatory, but I will try to explain the issue further here so as to be more precise. My code runs on an ESP8266-01 connected to a fan and is used to control it through Telegram (with its own bot) and Adafruit MQTT, from both of which it receives a command (not at the same time, it's just to have multiple ways to control the fan in case I don't have my phone by me). Anyway, this is where the problems kick in: after an indeterminate amount of time (could be 5 minutes,

ValueError: could not convert string to float: when using matplotlib, arduino and pyqt5

筅森魡賤 提交于 2021-01-29 14:02:21
问题 While using an arduino code (also connecting pin 13 to A0 in an arduino uno) to have changing values int PinOutput = 13; int PinInput = A0; int inph; int inpl; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(PinInput, INPUT); pinMode(PinOutput, OUTPUT); } void loop() { // put your main code here, to run repeatedly: inpl = analogRead(PinInput)/4; Serial.println(inpl); analogWrite(PinOutput,255); delay(1000); inph = analogRead(PinInput)/4; Serial.println

Best way to parse out incoming HTTP post request on Arduino?

不想你离开。 提交于 2021-01-29 13:02:25
问题 I'm writing a simple HTTP webserver on my Arduino Uno Wifi Rev2 to handle an incoming HTTP POST Request in JSON format. This is how I'm sending the HTTP request (with JSON) from my client: curl \ --request POST \ --header "Content-Type: application/json" \ --data '{ "A": "B", "C": "D" }' \ "http://192.168.4.1/myEndpoint" This is the string the Arduino web-server receives: POST /myEndpoint HTTP/1.1\r\nHost: 192.168.4.1\r\nUser-Agent: curl/7.54.0\r\nAccept: */*\r\nContent-Type: application/json

PN532 emulated card not read by an Android phone

青春壹個敷衍的年華 提交于 2021-01-29 11:42:20
问题 I am using Arduino UNO with elechouse's library and a PN532 module connected through SPI . I am trying to emulate a card using the emulate_tag_ndef example in that library, but when I try to read the emulated card with the NFC Tools app on my Samsung Galaxy S7 , I get an empty serial number and I don't get the Ndef message similarly to this. When I try to change the command array in the library according to the post lower on the linked issue on Github , then the emulated card cannot be

C# and Arduino Timeout function

别说谁变了你拦得住时间么 提交于 2021-01-29 08:50:56
问题 I'm currently working with a Arduino IDE and C# enviroment for a project. The principal idea is write and read values from some variables. I would like implement a Timeout after I change a variable to confirm that the change was done correctly or if happend a communication error. Could Anyone helpme with a Link or PDF info to understan the way to implement this feature? This is a part from the code: C# private void connectToArduino() { isConnected = true; string selectedPort = comboBox1

Reading from serial port gives split up string

偶尔善良 提交于 2021-01-29 06:57:52
问题 I am using the JSSC class to receive a string from an Arduino Uno. The Arduino is connected to my computer via COM3. In the setup void on the Arduino, it sends a string to the java program saying that the Arduino is ready to read serial data. What happens is when the java program reads the serial port, it splits up the string from the Arduino onto multiple lines with spaces. I imagine it is that java program is printing the data when its received instead of waiting for the full string. How

Communication speed over USB (PC/Arduino) using SerialPort in C# seems to “clip”

三世轮回 提交于 2021-01-29 06:45:36
问题 Prepare for a lengthy explanation - sorry. I'm building an application in C#, using Visual Studio 2019, that will communicate with some Arduino MEGA 2560 R3 devices. The connection is through USB Serial (if I'm not mistaken, this is USB CDC, right?). Communication runs fine over all kinds of baudrates, even up to 2000000. To make sure that my Arduino can "follow" the command rate sent by my PC, I'm using an ACK-protocol, which is as simple as my Arduino confirming each command with the

How to get a unique ID for each Arduino

心已入冬 提交于 2021-01-29 04:50:35
问题 I use two Arduino Nano, and want to change their name as listed in /dev , because currently they are always ttyUSB<NUMBER> . How can I get a unique serial number to create a udev rule? I tried to get it via udevadm , but it returns the same serial ID for both Arduinos. /var/log: udevadm info -a -n /dev/ttyUSB0 | grep '{serial}' ATTRS{serial}=="0000:00:14.0" 回答1: Arduino Nano is based on ATmega328 which does not have a built-in USB controller. The USB connector on the board is connected to an

Led Matrix Arduino

青春壹個敷衍的年華 提交于 2021-01-29 03:10:01
问题 I am not an electrical engineer, however I am putting together an Arduino Nano Led Matrix 40x20 Led grid, I was wondering what power supply I should use so everything works properly without destroying anything. This is what was recommended for a 10x10 grid. 5V 4A Power Supply: http://amzn.to/1UhdJfB I will also be using WS2812B LEDs if that makes any difference. Also if you know a good software to make the led animations that would be great too, the software I have is limiting. 回答1: According