c,linux,linux-device-driver,gpio
Output ports are often readable, so where you have outportb(0x103, 0x10); // set b4 ... outportb(0x103, 0x11); // set b1 and b4 You can do, say outportb(0x103, 0x10); // set b4 ... outportb(0x103, inportb(0x103) | 0x01); // set b0 too But sometimes it is not recommended to read / modify...
c,interrupt,gpio,atmel,atsam3x
I cannot help you with the actual function calls, but suppose you use a edge interrupt. As far as I see, you call an interrupt handler for each rising edge. However, after the first rising edge, you need to trigger on button release, which would be a falling edge, so...
python,multithreading,raspberry-pi,twisted,gpio
According to this documentation, the callback that you are passing to GPIO.add_event_detect is a "threaded callback" - meaning, it runs on a new thread. Calling a random Twisted API from a non-main thread is undefined - you will get random behavior. What you've seen so far is needing to send...
linux,linux-kernel,raspberry-pi,driver,gpio
In the book LDD3, if one driver want to control the pins of CPU, it should call request_region() function to declare the usage of the ports. First, the word "port" is ambiguous and requires context. Port can refer to a physical connector (e.g. USB port), or a logical connection...
Thanks to my friend Cleiton Bueno http://cleitonbueno.wordpress.com/ that found this solution for me: prerequisites: apt-get install devmem2 Code that solved the problem: devmem2 0x47401c60 b 0x00 sleep 1 echo "usb1" > /sys/bus/usb/drivers/usb/unbind sleep 20 echo "usb1" > /sys/bus/usb/drivers/usb/bind sleep 1 devmem2 0x47401c60 b 0x01 The "devmem2" command is responsible to...
I figured out what I was doing wrong, good news...My GPIO works just fine! The problem was that I had the try/finally blocks inside of the while block, instead of the while block inside of the try block. What was happening is that the io.cleanup() method gets called, removing the...
Sounds like you have 3 logical blocks: Individual LED control Master LED control Monitor-LED indicator control Decouple your code into functions, let's name them checkIndividualButton, checkMasterButton and updateMonitorLed, one for each logical block, and call them from your main loop import RPi.GPIO as GPIO import time # our 3 functions...
I incorrectly thought that kernel pins were calculated as 32 * N + M for gpioN[M]. The kernel pin is determined by the offset from 44e10. pin 8 above has offset 820, which corresponds to gpio0[22] and p8.19. If you export 22 and check p8.19, the desired result is produced....
python-2.7,colors,tkinter,raspberry-pi,gpio
1) I think you need timer to run atur() to test if push-button was pressed. Now program doesn't know that you pressed push-button In __init__() and in atur(): self.parent.after(10, self.atur) 2) Yes it is possible with self.parent.after(milliseconds, function_name) 3) Do you mean two push-button connected to GPIO ? I think...
python,email,while-loop,raspberry-pi,gpio
Your problem is actually two problems. First, it's printing "SENT 1 MAIL" continuously because the else clause is going to reset your mail_sent whether the lever is up or mail_sent is not 0. You might want to specify that the lever should be up before mail_sent can reset: if input_state...
apparently, there some initialization that need to pass before GPIO registers (or any register) can be access easily. before the call to rest_init function there's no problem with init and play with those registers.
As far as I know, it is not possible to get this particular behavior with Boost.Asio. While the kernel flags some files on the procfs and sysfs as pollable, they do not provide the stream-like behavior that is expected from boost::asio::posix::stream_descriptor and its operations. Boost.Asio's epoll reactor is edge-triggered (see...
In the issue you link to you are connecting to port 1833 instead of port 1883.
With the code you posted, when only one input is set, the corresponding output is rapidly toggled on and off in your loop rather than remaining on, giving an output voltage that averages somewhere between that of a high output and that of a low one. This happens because although...
c,embedded,microcontroller,gpio,microprocessors
One single ISR triggered is not sufficient to detect a single button press. Because of the electro-mechanical signal bounce you get from all buttons, you need some kind of de-bouncing algorithm. Furthermore, you need the program to be immune to EMI so that multiple interrupts won't create havoc on the...
As mentioned in the comments try it as a function. print became a function instead of a statement for example teststring = "hello world" print(teststring) ...
Seems like the API is working as it is supposed to working, For example when you press a button current will start to flow to the read pin in return the pin will be keep on get an HIGH event until you release the button. What you must do is...
python,linux,raspberry-pi,gpio
Not only access to /dev can be privileged for access, also the device itself will probably be protected. You should do an ls -l /dev and check the I/O device you are trying to access. Once you see the group, try adding yourself to that group: $ sudo usermod -aG...
Yes. When you configure the pin as GPIO input it is high-Z, i.e. it is tri stated. That's perfect for an input pin, your external hardware will define the level. When you enable the RXEN you get a resistor that is a pull up or down. This depends on the...
input_state = GPIO.input(10) and if input_state == False: should be at the same level of indentation, which is exactly what the error message is saying. There is no reason to indent the second line (since the previous one doesn't open a new block, so indenting it is an error). ...
The number of ports depends on the pin count of the specific STM32F4 model you're using. Each port has at most 16 pins, so models with, say 64 pins, will have less ports (around 4 to 5) than models with 176 pins (10 or possibly 11 ports). The datasheet indicates...
python,module,install,raspberry-pi,gpio
First you should look for the file vcvarsall.bat in your system. If it does not exits I recommend you to install Microsoft Visual C++ Compiler for Python 2.7. This will create the vcvarsall.bat in "C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0" if you install it for all users. The problem...
You could use jQuery's $.ajax Just give the img an id and you can do something like this: (example) $("img#light-on").click(function(){ $.ajax({ type: "POST", url: "light-on.php", data: {lighton: "true"}, success: function(){ $("p.status").html("The light is on!"); } }); }); You then have to just run the same thing for img#light-off and go...
javascript,node.js,raspberry-pi,gpio,homekit
{ cType: types.POWER_STATE_CTYPE, onUpdate: function(value) { if(value == 1){ exec('gpio write 7 0') setTimeout(function() {exec('gpio write 7 1')},250) } if(value == 0){ exec('gpio write 6 0') setTimeout(function() {exec('gpio write 6 1')},250) } }, perms: ["pw", "pr", "ev"], format: "bool", initialValue: false, supportEvents: false, supportBonjour: false, manfDescription: "Turn On the Light",...
Finally it was not as hard as I thought it would be. Despite the fact that Raspberry-PI B+ has got a lot of PIN's it has only got one PIN (GPIO 18 = Pin 12) PWM can be controlled via console by. These are the commands to control Duty Cycle...
raspberry-pi,sampling,i2c,gpio,inertial-navigation
Solved it by using SPI instead of I2C. Now I can get data at stable 2000HZ sampling rate.
Python’s boolean constants are capitalized: True and False with upper case T and F respectively. The lower-case variants are just free names for variables, so you could use them for whatever you want, e.g. true = False (not recommended ;P)....
linux-device-driver,i2c,gpio,irq,device-tree
Found the solution. Not only i2c_board_info has an of_node, but struct device as well. So the device node can be accessed via client->dev.of_node.
A nice way to achieve this would be to use the combination of struct and union. With a union, you can access the same memory in two different ways. For example: union gpio_type { uint8_t data; struct raw { unsigned int b0 :1; unsigned int b1 :1; unsigned int b2...
stdout by default is line-buffered, meaning it tries to put off writing data to the underlying file until a newline. But since you never print a newline, stdout will just buffer your text until it runs out of space. You can fix this by either adding a newline in the...
it will remain high until you tell it to go low with GPIO.ouptut(xxxx,GPIO.LOW) you switch the pin to input you turn off the pi (obviously) ... sometimes pins float a little so you might need a resistor in there somewhere (I think rpi has internal resistors for gpio iirc) it...
java,raspberry-pi,raspbian,gpio
You need to unProvision your pin. After u call .shutdown() you need to do the following ... gpio.shutdown(); ... gpio.unProvisionPin(pin); ... This should release pi4j's internal reference and allow you to reprovision it later...
You can use threaded callbacks on event_detect. As per raspberry-gpio-python, you can make use of something like this. GPIO.add_event_detect(channel, GPIO.RISING, callback=my_callback) Where event could be GPIO.RISING, GPIO.FALLING or GPIO.BOTH, my_callback is a normal python function which behaves like an ISR which is run in a different thread. Hope it helps....
python,multithreading,raspberry-pi,gpio
I can't help but feel that the following code: GPIO_PWM1=14 GPIO_PWM2=15 GPIO_SW1=11 would be better as constants at the top of your entire program, at which point you could just call upon them from anywhere in the program to output to them, and then this entire problem would cease to...
linux-kernel,arm,interrupt,gpio
What is the advantage of using GPIO as IRQ? If I get your question, you are asking why even bother having a GPIO? The other answers show that someone may not even want the IRQ feature of an interrupt. Typical GPIO controllers can configure an I/O as either an...
The problem had nothing to do with Pi4J. The sleep period wasn't exact enougth. "The granularity of sleeps is generally bound by the thread scheduler's interrupt period. In Linux, this interrupt period is generally 1ms in recent kernels. In Windows, the scheduler's interrupt period is normally around 10 or 15...
You use the mount(2) system call. From the manpage: SYNOPSIS #include <sys/mount.h> int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); So, in your C code, that'd look something like: #include <sys/mount.h> /* ... */ void mount_sys() { if (0 != mount("none", "/sys",...
embedded,embedded-linux,boot,gpio,u-boot
Recovery may depend on what your system has available to you, and how robust you need to be. Remember to always keep everything you can read-only and seperated it from stuff that is writeable. Keep writeable stuff in a different partition in your NAND or wherever. Your method described above...
From man read: On files that support seeking, the read operation commences at the current file offset, and the file offset is incremented by the number of bytes read. If the current file offset is at or past the end of file, no bytes are read, and read() returns zero....
python,gpio,messagebroker,iot,hivemq
In order to start HiveMQ in the background, you can install it as a service. The details are covered in the documentation here. If you have a debian based system, execute the following commands: cp /opt/hivemq/bin/init-script/hivemq-debian /etc/init.d/hivemq chmod +x /etc/init.d/hivemq For other Linux Systems the following should do it: cp...
Shouldnt you be checking for the full set of values? ie if not value1 and not value2 and not value3 and not value4: # reset elif value1 and not value2 and not value3 and not value4: #light up led 1 elif not value1 and value2 and not value3 and not...
python,multithreading,raspberry-pi,gpio,omxplayer
You need to implement your own threads: class RaspberryThread(threading.Thread): def __init__(self, function): self.running = False self.function = function super(RaspberryThread, self).__init__() def start(self): self.running = True super(RaspberryThread, self).start() def run(self): while self.running: self.function() def stop(self): self.running = False Then remove the while loops from your functions so you can pass them...
python,raspberry-pi,gpio,raspberry-pi2
The script (or more precisely, the hardware.py-module) uses the RPIO module which has seen it's last release 2013 (https://github.com/metachris/RPIO), and thus doesn't support the RPi2. You can either create an issue in the RPIO-tracker, and hope for an updated version (not sure how likely that's going to happen though) rewrite...
java,debugging,cross-compiling,gpio,beagleboneblack
Debugging You can run the Java program on the Beaglebone black, and then connect to it remotely for debugging. This lets you set breakpoints, do basic hot code swaps, etc. More info: Remote debugging a Java application Remote Development To develop on the Beaglebone directly, you have a few options....