arduino

Cant use Micro-Coap library for arduino

别来无恙 提交于 2019-12-11 20:33:18
问题 I am trying to get the micro-coap librarby (https://github.com/1248/microcoap) to work on my arduino. When I try to compile it in the Arduino IDE, it reports that <sys/socket.h> dependency in main-posix.c can not be found. Searches for the problem were not helpful, except for some general C++ answer that was hinting that there is no sys/socket.h on Windows. But this should not have anything to do with Arduino right? I looked at the ethernet library for arduino and there is a socket.h but it

Receiving multiple chars at once with Software Serial

僤鯓⒐⒋嵵緔 提交于 2019-12-11 20:30:11
问题 I have a Arduino Uno R3 and a Bluetooth Mate. When linking the Mate to the Arduino Hardware Serial (pin 0,1) I can send multiple characters at once from my connected device but when I try to make the same thing with Software Serial (using pin 4,2 for example) I only get the first character and the rest of the chars are messed up. My code: #include <SoftwareSerial.h> int bluetoothTx = 4; int bluetoothRx = 2; SoftwareSerial bluetooth(bluetoothTx, bluetoothRx); void setup() { Serial.begin(115200

How to update values from serial port in matplotlib animations?

梦想的初衷 提交于 2019-12-11 20:29:21
问题 I've been trying to plot serial data from an arduino in real-time using matplotlib's animation function. The data comes from a ntc temperature sensor. The plot I was able to get displays a sigle line all the time, and the line is only translated up or down as the teperature changes. I'd like to know what can I do to view the curves representing the changes in the plot. Here´s the code: import serial from matplotlib import pyplot as plt from matplotlib import animation import numpy as np

bistable single push toggle using momentary pushbutton, NO contiguous toggle upon hold

流过昼夜 提交于 2019-12-11 19:49:31
问题 How to stop contiguous state change upon button hold? const int btn = 5; const int ledPin = 3; int ledValue = LOW; void setup(){ Serial.begin(9600); pinMode(btn, INPUT_PULLUP); pinMode(ledPin, OUTPUT); } void loop () { if (digitalRead(btn) == LOW) delay(100); { ledValue = !ledValue; delay(100); digitalWrite(ledPin, ledValue); delay(100); Serial.println(digitalRead(ledPin)); } } When I hold the button I receive contiguous state change. I want to press button and receive single state change,

Sending Long integer values from Arduino and receiving them from C# app?

狂风中的少年 提交于 2019-12-11 19:45:16
问题 As title gives it away I am trying to just send Long integer values from arduino and receiving it from my C# application. My Arduino code is void setup() { Serial.begin(9600); } long n; byte b[4]; void loop() { n=500; for (int i=0; i<10; i++) { n = n+20; IntegerToBytes(n, b); for (int i=0; i<4; ++i) { Serial.write((int)b[i]); } delay(1000); } } void IntegerToBytes(long val, byte b[4]) { b[3] = (byte )((val >> 24) & 0xff); b[2] = (byte )((val >> 16) & 0xff); b[1] = (byte )((val >> 8) & 0xff);

Plotting Serial data in Python how to pause matplotlib figure?

亡梦爱人 提交于 2019-12-11 19:32:11
问题 Basically I want to pause the live plot that I have setup here: import serial import numpy as np from matplotlib import pyplot as plt ser = serial.Serial('/dev/tty.usbmodemfa131', 9600) #Setting up the animated plot plt.ion() # set plot to animated fig = plt.figure() ydata = [0] * 100 ax1=plt.axes() # make plot line, = plt.plot(ydata) plt.ylim([24,29]) #Starting data collection while True: rawData = ser.readline().rstrip() x = len(rawData) #print(floatData) if len(rawData) <= 6: try: data =

how do i send timestamp from RTC to website in a Get request? using arduino

我是研究僧i 提交于 2019-12-11 19:01:41
问题 Hi i have been trying to send data from my arduino to my ASP.Net website and have been successful until i try to send a timestamp as a variable in the GET request. I have think it has somthing to do with the forward slash that separates the values but when i send a diffrent symbol like a "-" i get the same result (no data saved) EDIT: sorry its not the forward slash! it is because asp.net expects: 01/01/01 01:01:01 and am sending 1/1/1 1:1:1. so i need to figure out how send it with the zero

Arduino: Inheritance and arrays of pointer subclasses

匆匆过客 提交于 2019-12-11 18:57:57
问题 This is problem #2 from this previous question: Inheritance in Arduino Code Building off of Steven's answer, I do need the array that holds the pointers to persist outside of its scope, which is resulting in some weird behavior. This is my "Board" class I have so far, that contains multiple child elements: Board.h: #ifndef Board_h #define Board_h #include <StandardCplusplus.h> #include <serstream> #include <string> #include <vector> #include <iterator> #include "Arduino.h" #include "Marble.h"

Controlling LED using serial port

时光总嘲笑我的痴心妄想 提交于 2019-12-11 18:52:41
问题 As part of a simple Automation project, I was trying to control some LEDs through serial port. I cannot make the following code working int pin =0; int state = 0; void setup() { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps } void loop() { // send data only when you receive data: if (Serial.available() > 0) { // read the incoming byte: if(Serial.read() == 'S' && Serial.read() == 'S') { // Command to set the pin pin = Serial.read() - 65; state = Serial.read() - '0';

Server not sending HTTP 101 response when creating a websocket using CC3000 and socket.io

醉酒当歌 提交于 2019-12-11 18:45:01
问题 I am connecting CC3000 to a node.js server using socket.io. I have used the following library to create a websocket https://github.com/chadstachowicz/socket_io_arduino_cc3000 In SocketIOClient.cpp, it creates a TCP connection, gets a session-id(sid). It disconnects and creates another TCP connection and uses the sid to upgrade the connection to websocket. For this the client(here CC3000) sends the following header information: client.print(F("GET /socket.io/1/websocket/")); client.print(sid);