you should type:
if your file is in the current directory.
also, you might check if executable bit is set with
ls -al a.out
and if not, set it using
chmod +x a.out
however, most compilers will set executable bit for you automagically.
You need to put a ./ in front of a.out in order to execute that:
When you type the name of a program such as a.out the system looks
for the file in your PATH. On my system, PATH is set to
Yours is probably similar. To check, enter ...
Do NOT use nano (or another text editor to put your code into) with root/sudo permissions (ie. do not edit with sudo nano, only use nano) if all you are doing is personal stuff that does not need superuser permissions.
To compile from the command line (assuming yourcode.c is the name of your C file, and program the name of the resulting program ...
I wrote a very simple kernel years ago, and ran it on a 386. I haven't done bare metal programming in years, but in broad terms you need to write some assembler code that will:
disable interrupts during the boot process
if the Pi has a memory controller, you'll need to set that up
set up a timer tick
configure the interrupt controller
set up a stack so ...
You can read the file /sys/class/thermal/thermal_zone0/temp, as specified in this answer. There it's about measuring from the command line, and the file is read with cat. But you should be able to just open the file in C. The temperature is returned in milli-degrees Centigrade and as ASCII numbers.
Perhaps like this, not tested :)
I haven't looked at your code in depth, but it seems to me you're on the right track. Make sure that:
The _start symbol is indeed the one used when compiling & linking your assembly file and your C file (and that main() isn't used instead)
When calling main(), you need to use the C calling convention:
push on the stack the address of the instruction ...
Mechanical buttons and switches can suffer from switch bounce where they toggle rapidly between open and closed for several milliseconds.
You can try debouncing the button/switch in software or hardware.
Probably simplest in software.
If the level changes (on to off, or off to on) wait x milliseconds and read the gpio again. If it is still in the new ...
The RPI ARM core is an ARM 1176jzf-S, the suitable flags should then be
-march=armv6zk -mcpu=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp
Drop the -mfloat-abi=hard -mfpu=vfp when on a soft float distro.
These flags can be found by running gcc -mcpu=native -march=native -Q --help=target on gcc >= 4.7`
There is no official library
There are several options. I usually use http://wiringpi.com. This is used for the gpio utility included in recent Raspbian releases.
Joan's pigpio library is at https://github.com/joan2937/pigpio and she also has Python wrappers. If you want to use sockets or a daemon this is recommended and has good support for hardware and ...
I have never tried to do this no the RPi, but I have on the Arduino platform several times, and I have used something along the lines of this Arduino code. Note you will have to rewrite a function similar to this for whatever language you are using:
unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = ...
Take the time to read Jack Ganssle's debouncing guide. The first page illustrates the problem in great detail, and the second how to deal with it in hardware or software. There isn't a 'perfect' debounce method, but there are a lot of bad ones!
This is a problem you will come across repeatedly if interfacing software with switches, so it's worth taking ...
I want to modify the distro according to my needs. [...] What about
the source for the actual distro? Is it all there? Am I insane?
The distro has sources, but these are either the same as or slightly patched versions of the original sources -- a distro does not really contain any original software per se (discounting the package manager), it is just an ...
That example from elinux uses memory-mapped IO. The kernel also exports a user space interface via /sys/class/gpio,1 which is also documented on elinux. Working in C you would use low level read()/write() instead of echo, obviously. Don't use higher level stream based functions.
Some programmers become a bit upset when told to use a file interface for ...
Yes it's safe. Judging from the source code of the library, it doesn't cache the values but reads them each time you call digitalRead function so it should work as expected.
It isn't really documented in the wiringPi documentation but at least the documentation also doesn't say it's forbidden (for example for digitalWrite there ...
First and foremost:
If I were in your shoes, I would stay away from Wiegand in general!!!
Wiegand is a swipecard protocol developed in the 1980s. It does not use any form of clock signal or speed indication, the data timing is done based on the last bit that was transferred + the Wiegand delay time. This is a disadvantage but does not make it ...
I cannot see a call to bcm2835_init() which must be called before calling any other functions in the bcm2835 library.
Also ensure you run your program with root access, since this is needed to use the bcm2835 library.
command to run code in /etc/rc.local
Three things to remember when putting commands in rc.local:
Don't use sudo, because the script is run as root anyway.
Unless the command exits quickly, it must fork to the background. This is accomplished by adding & to the end:
$PATH may not be set. This is a list of directories where the shell ...
You seem to be creating then sending 1000 waveforms. There will be jitter between each waveform.
Try generating one big waveform and sending that.
Basically de-indent the lines
wid = pi.wave_create()
if wid >= 0:
so that they are executed after the for loop (just the once rather ...
This returns the same thing as reading /sys/class/thermal, i.e., the core temp. Reading the /sys file is preferable programmatically because it is just a sequence of open/read system calls, instead of a fork/execute plus a bunch of open/read/write with pipes.
How would I read the GPU temperature aswell?
The BCM2835/6 ...
To set a pin numbering scheme you use one of four Setup functions:
int wiringPiSetup (void);
int wiringPiSetupGpio (void);
int wiringPiSetupPhys (void);
int wiringPiSetupSys (void);
To use BCM GPIO numbering you would replace you would use wiringPiSetupGpio(void); and modify the pin numbers in your code appropriately.
I'm wondering, may understand that Raspberry Pi's I2C is in fact the SMBus version of I2C ?
I don't think it is limited in that sense but that is the normative way to use it. There is no such limitation with the kernel, since the protocol docs for the interface say, "If you write a driver for some I2C device, please try to use the SMBus commands if at all ...
Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI.
This is different from static libraries. If you use a static library at build time, all the needed code from the library would be included in the executable, and the library would not be needed to run ...
Sniffing other WiFi networks you are not associated must be supported by the WiFi chip, called monitor mode. If you look at the chip configuration on the RasPi with:
rpi ~$ iw list
--- snip ---
Supported interface modes:
Very similar thing is possible in Linux using so called framebuffer. It's a lowlevel graphics interface on Linux. You can interact with it using /dev/fb0 device. After opening this device you can call bunch of ioctl calls on it in order to configure it (setup resolution, BPP, etc) and query it's current settings. Then, you can just write bytes ...
MAXTIMINGS means how many databits that the sensor sends is going to be read and stored (note that acording to the datasheet, it should send 40 bits in response).
In order to understand this, you have to first understand how DHT22 is sending it's data to the host computer. It uses one wire, where host sends start signal:
Compiling C programs on the raspberry pi is rather simple. First, create your program in a text editor and save it as <insert name>.c It should be saved on the Desktop.
Next, open terminal. In it type:
This changes the directory that the terminal is looking at to Desktop. This is also where our program is stored.
gcc -Wall <myName>....
I misunderstood your question initially. Here is some C code that, when run, will record raw PCM data. You must pipe this to another program or lots of gibberish will be printed to the console.
/* Use the newer ALSA API */