arduino

Unable to get arduino serial communication working in wxpython GUI

房东的猫 提交于 2020-01-03 05:37:06
问题 This is the definition which is used to update the labels in the GUI: def updateV(self, event): """""" global v ser = serial.Serial( port='COM3', baudrate=9600) x = ser.read() # read one byte ser.close() print x if v>3: self.labelOne.SetBackgroundColour('red') self.labelOne.SetLabel('Battery Voltage : ' + x) else: self.labelOne.SetBackgroundColour('white') self.labelOne.SetLabel('Battery Voltage : ' + str(v)) self.Refresh() This is the simple arduino code i have been using: int a; void setup(

How to connect pinoccio to apache couchdb

不羁岁月 提交于 2020-01-03 03:25:12
问题 Is there anyone using the nice pinoccio from www.pinocc.io ? I want to use it to post data into an apache couchdb using node.js. So I'm trying to poll data from the pinnocio API, but I'm a little lost: schedule the polls do long polls do a completely different approach Any ideas are welcome Pitt 回答1: Sure. I wrote the Pinoccio API, here’s how you do it https://gist.github.com/soldair/c11d6ae6f4bead140838 This example depends on the pinoccio npm module ~0.1.3 so make sure to npm install again

Alternative to many case switch statement in C

白昼怎懂夜的黑 提交于 2020-01-02 23:14:39
问题 I have a 8 bit byte that represents the states of 8 physical switches. I need to do something different for each permutation of switches being on and off. My first idea was to write a 256 case switch statement, but it quickly became tedious to type. Is there a better way to do this? Edit: I should have been a bit clearer on the functions. I have 8 buttons that each do one thing. I need to be able to detect if multiple switches are pressed at once so I can run both functions at the same time.

Debouncing a limit switch in Arduino ISR with delays

雨燕双飞 提交于 2020-01-02 23:07:11
问题 I have a limit switch attached to an arduino Mega 2650 for motion control. The limit switch's two Normally Open contacts are connected to an Arduino Pin and ground, such that when the Limit Switch is engaged, the Arduino Pin gets short circuited to ground. As expected, I have bouncing issues with this setup. I confirmed it using counters in my ISRs. Finally, I wrote the following code that seems to reliably identify whether my limit switch is engaged or disengaged at any given point in time.

Arduino - Iterate through C array efficiently

北城以北 提交于 2020-01-02 08:57:45
问题 I have the following array: PROGMEM prog_uint16_t show_hide_info[] = { 4216, 8900, 4380, 580, 500, 600, 500, 580, 1620, 580, 500, 600, 500, 580, 500, 600, 480, 600, 500, 580, 1620, 580, 1620, 600, 500, 580, 1620, 580, 1620, 600, 1600, 600, 1620, 580, 1620, 600, 500, 580, 1620, 580, 500, 600, 1600, 600, 500, 580, 1620, 580, 500, 600, 1620, 580, 1620, 600, 480, 600, 1620, 580, 500, 600, 1600, 600, 500, 580, 1620, 580, 500, 600, 39300, 8860, 2160, 580, 0 }; I'd like to be able to loop through

Arduino Uno Upload Fails

本小妞迷上赌 提交于 2020-01-02 08:42:05
问题 I have received an arduino uno and some code for it as part of a project I am working on. I have never worked with them before so this is a completely new experience for me. I am using the Arduino application from their website and when I compile the code it works fine. When I upload however I get the error: avrdude: stk500_getsync(): not in sync: resp=0x41 I have looked at every single google result returned for this and I haven't gotten anywhere. I have tried uploading on 3 different

Why doesn't this compiler barrier enforce ordering?

天涯浪子 提交于 2020-01-02 07:54:07
问题 I was looking at the documentation on the Atmel website and I came across this example where they explain some issues with reordering. Here's the example code: #define cli() __asm volatile( "cli" ::: "memory" ) #define sei() __asm volatile( "sei" ::: "memory" ) unsigned int ivar; void test2( unsigned int val ) { val = 65535U / val; cli(); ivar = val; sei(); } In this example, they're implementing a critical region-like mechanism. The cli instruction disables interrupts and the sei instruction

Unique machine ID for arduino project

随声附和 提交于 2020-01-02 07:53:11
问题 I am building some remote sensor nodes for arduino, they will use RF to transmit data back to a base station. Is there some sort of unique id backed into arduino that I can use to identify the remote arduino sensor node to the base station? If not, how do others solve this issue? I realize that I could hard code a nodeid when I compile the source for that node, just seems like that would not scale too well. What I need is something analogous to a mac address in http land. 回答1: (sorry for bad

Android Host Card Emulation with Arduino

≡放荡痞女 提交于 2020-01-01 19:34:49
问题 I am trying to build a communication between my Nexus4 HCE and Arduino PN532 Chip. on The Serial Monitor of Arduino,I could see some data transaction happening. But on ANdorid side, I get CET4T: Unsupported Class byte (0x60) CET4T: Unsupported Class byte (0xA0) BrcmNfcNfa﹕ UICC[0x0] is not activated Below is my apduservice.xml <host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android" android:description="@string/servicedesc" android:apduServiceBanner="@drawable/ic_launcher

Android Host Card Emulation with Arduino

女生的网名这么多〃 提交于 2020-01-01 19:34:05
问题 I am trying to build a communication between my Nexus4 HCE and Arduino PN532 Chip. on The Serial Monitor of Arduino,I could see some data transaction happening. But on ANdorid side, I get CET4T: Unsupported Class byte (0x60) CET4T: Unsupported Class byte (0xA0) BrcmNfcNfa﹕ UICC[0x0] is not activated Below is my apduservice.xml <host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android" android:description="@string/servicedesc" android:apduServiceBanner="@drawable/ic_launcher