arduino

Arduino Sends Old Data Through Serial

送分小仙女□ 提交于 2019-12-25 09:13:47
问题 I think my problem would best be explained with an example. Here is some Arduino Code: void setup() { Serial.begin(9600); } void loop() { Serial.println(millis()); delay(1); } ...and here is the output: Now, those numbers at the beginning aren't just your regular old first-bytes-of-serial-data-are-always-messed-up numbers. Those numbers are left over from the last time I opened the serial monitor. How do I know this? Because I counted how many seconds had gone by since I last opened the

Arduino 'Error communicating…unicode strings are not supported, please encode to bytes' PySerial

回眸只為那壹抹淺笑 提交于 2019-12-25 09:12:10
问题 I'm trying to connect to my MultiWii over PySerial, however I keep getting this error. Error communicating...unicode strings are not supported, please encode to bytes: '$M<\x00ll' This is the part of the code that's failing: BASIC="\x24\x4d\x3c\x00" MSP_ATTITUDE=BASIC+"\x6C\x6C" ser.write(MSP_ATTITUDE) I've tried encoding the strings with .encode() in which I get this error: Error communicating...'bytes' object has no attribute 'encode' I've tried bytearray(MSP_ATTITUDE,'ascii') and get the

What is happening in this C/Arduino code?

ぃ、小莉子 提交于 2019-12-25 08:07:29
问题 I'm new to C and Arduino development and wondering what's going on here. The code is supposed to print the response from an HTTP request, but instead it cuts off after around 300 bytes. static void my_callback (byte status, word off, word len) { Ethernet::buffer[off+300] = 0; // <-- Serial.print((const char*) Ethernet::buffer + off); // <-- } In Javascript, Ethernet::buffer[off+300] = 0 would mean you're assigning a value of 0 to something in an object or array, at position [off+300] . Why is

Arduino: Change defines without edit library [solved, bug in compiler, workaround available]

牧云@^-^@ 提交于 2019-12-25 07:25:42
问题 edit: See my answer below I'm fairly new to the Arduino platform and creating now an USB HID project with the attiny85 (Trinket) library of AdaFruit. See also my previous answered question about the options of this library: Change/Override Trinket (attiny85) USB identification name, device name I'm stumped on a rare C-related limitation (see also latest comment at answer in link above to previous question), the separated late binding of binaries by separated compiling. If you want to change

Arduino Multitasking

你离开我真会死。 提交于 2019-12-25 07:01:59
问题 I got the problem, that the following code ain't multitasked. How can I realize that? My code works at the moment as follow: I start my Android app, there I confirm the USB request. After the press of the "start button", my app sends a byte array to my arduino board. The problem is that "stepper2(ingredient1value);" can only start when "stepper1..." finished. I know that arduino ain't the right plattform for multithreading, but I saw some solutions, but I can't integrated them into my code.

How to control a 3D model via the API in Catia

天大地大妈咪最大 提交于 2019-12-25 06:39:23
问题 I have the following scenario: i am building a animatronic hand using some flex sensor, arduino board and 5 servo. No problem on this side. But i have the following idea: to build a 3D CAD model of the hand in Catia, and in real time the virtual hand to copy the movements of the real hand in real time. I used something in Matlab when i did some plots in real time with some data from some sensor. It is posible to do that in Catia? To get the data from arduino and based on that data to simulate

Why “fifoBuffer” values of indexes 2,3,6,7,10,11 are not passed in the teapotPacket[] array?

痴心易碎 提交于 2019-12-25 05:32:43
问题 I'm using the MPU6050 library by Jeff Rowberg. In the code, while passing data to the Teapot library(for processing,i.e, graphics emulation), whole fifobuffer is not passed. Why is that so ? Here's the code, see only few indices of fifobuffer array are passed. teapotPacket[2] = fifoBuffer[0]; teapotPacket[3] = fifoBuffer[1]; teapotPacket[4] = fifoBuffer[4]; teapotPacket[5] = fifoBuffer[5]; teapotPacket[6] = fifoBuffer[8]; teapotPacket[7] = fifoBuffer[9]; teapotPacket[8] = fifoBuffer[12];

pyserial when it is the end of the line stop the while loop

夙愿已清 提交于 2019-12-25 05:20:43
问题 import serial arduino = serial.Serial('COM12', 9600, timeout = .1) arduino_data = [] # declare a list while True: data = arduino.readline() if data: arduino_data.append(data) # Append a data to your declared list print arduino_data I wonder when there is no more new line from Arduino side, how can i jump out the while loop? while True: data = arduino.readline() if data: arduino_data.append(data) # Append a data to your declared list print arduino_data break It only works for 1 line. 回答1: Wait

I2C addresses > 63 are not usable with atTiny85

时光怂恿深爱的人放手 提交于 2019-12-25 04:37:52
问题 Hi I have a big problem with addressing multiple attiny85-chips with I2C: For what I know the attiny uses 7-bit addresses for communication. I am using the TinyWireS lib, which works perfectly fine for me, untill I am reaching address: '64' which is '1000000' in binary. The highest usable address should be '1111111'. This is what happens: Slave: Attiny85: switches led on or off when msg is received over I2C. Slaveaddress: 64 #include <TinyWireS.h> #include <usiTwiSlave.h> #define output (4)

My SerialPortEvent does not receive data using jSSC in a continous loop

痞子三分冷 提交于 2019-12-25 04:31:46
问题 I have been trying to use serial communication with my Arduino Uno and have used the library jSSC-2.6.0. I am using a SeriaPortEvent listener to receive bytes from the Serial Port (Arduino) and store them in a linked list. public synchronized void serialEvent(SerialPortEvent serialPortEvent) { if (serialPortEvent.isRXCHAR()) { // if we receive data if (serialPortEvent.getEventValue() > 0) { // if there is some existent data try { byte[] bytes = this.serialPort.readBytes(); // reading the