Go to advanced search

by Redrobes
Mon Oct 14, 2013 11:48 pm
Forum: Graphics programming
Topic: How To Install & Use SDL2 on Raspbian PI
Replies: 22
Views: 48837

Re: How To Install & Use SDL2 on Raspbian PI

Bravo ! Nice long and verbose bit of information to get it going. I think there was another post about how to get SDL2 going with some more good advice on the boards somewhere - C++ forum topic I think. Anyway, this is something I would like to have a play with when I get some time. I'm sure its pos...
by Redrobes
Sat Jun 22, 2013 10:56 pm
Forum: C/C++
Topic: little problem with if statement
Replies: 4
Views: 1082

Re: little problem with if statement

it depends on what "type" your nt.nti.nai.abtUid is. It would tell you in the nfc.h include file tho. Assuming its an "unsigned int" then its probably: if( nt.nti.nai.abtUid == 0x0a1f33c4 ) { do something.... } You may find that it could be if( nt.nti.nai.abtUid == 0xc4331f0a ) { do something.... } ...
by Redrobes
Thu Mar 28, 2013 2:22 pm
Forum: General programming discussion
Topic: How do I Round Numbers ?
Replies: 4
Views: 1714

Re: How do I Round Numbers ?

I agree with joan's answer which is perfect for this case of sqrt. But for the case where people may come across this thread for something else and the numbers to be rounded can be negative then you need to sort that out first. Something like this: if( num < 0 ) { pos = -num; pos += 0.05 pos *= 10 p...
by Redrobes
Wed Mar 06, 2013 12:37 pm
Forum: Off topic discussion
Topic: Problem with zener diodes.
Replies: 2
Views: 969

Re: Problem with zener diodes.

According to the data sheet the graph shows that the 3V3 zenner is flat across 1mA to 20mA so if you put 2mA in there then it should show the right voltage. Not sure why it wouldnt. So try a 1K resistor and see if it helps.
by Redrobes
Wed Feb 27, 2013 7:49 pm
Forum: General discussion
Topic: Question about using the RPi with a relay.
Replies: 73
Views: 71468

Re: Question about using the RPi with a relay.

Piccy as required... My best guess / advice but don't sue me bro... Since there is no relay Gnd I think you have to connect the Gnd from the raspi to the external PSU Gnd. http://www.viewing.ltd.uk/Raspi/Relay1/RaspiRelayConnections.png As for it being compatible with 3.3V its a maybe - someone post...
by Redrobes
Wed Feb 27, 2013 12:41 pm
Forum: General discussion
Topic: Question about using the RPi with a relay.
Replies: 73
Views: 71468

Re: Question about using the RPi with a relay.

My view is that circuit in post #49 is close but you should use a 74HC14 hex schmitt inverter instead of the two parts listed. The UL part is for driving high power loads and the 7407 is similar. The part I believe you need is this: http://www.technobotsonline.com/74hc14-hex-schmitt-trigger-31756.ht...
by Redrobes
Tue Feb 26, 2013 11:14 am
Forum: General discussion
Topic: Question about using the RPi with a relay.
Replies: 73
Views: 71468

Re: Question about using the RPi with a relay.

From the circuit diagram the opto isolators are driven from the GPIO pins so the 5V / 3.3V mismatch would only cause a difference in current through the opto isolator LED & visual LED. Its impossible to say whether 3.3V is going to trigger the opto but it has a good chance of working ok. If they did...
by Redrobes
Sun Feb 24, 2013 11:49 pm
Forum: C/C++
Topic: Wiring Pi
Replies: 4
Views: 2341

Re: Wiring Pi

An LED can be connected to a GPIO pin with a resistor. 330 is probably a good choice but it depends on the LED. Theres two parameters you need to determine from your LED. You need to know a good drive current and also its forward voltage. Generally an LED is bright at about 10mA but you can get low ...
by Redrobes
Sun Feb 24, 2013 11:17 pm
Forum: General discussion
Topic: RasPi as universal Remote
Replies: 36
Views: 22950

Re: RasPi as universal Remote

I am struggling to understand what is the difficulty with this kind of thing. Its very easy to get the RPi to generate a signal on a GPIO pin. Its fast enough to be able to generate 38KHz without having to resort to using the audio jack (which is well dodgy if you ask me). I have shown and uploaded ...
by Redrobes
Tue Feb 19, 2013 9:10 pm
Forum: General discussion
Topic: IR remote with GPIO port
Replies: 3
Views: 1294

Re: IR remote with GPIO port

I just built and tested that. You can download the code for it:

http://www.raspberrypi.org/phpBB3/viewt ... 33&t=32152
by Redrobes
Tue Feb 19, 2013 9:05 pm
Forum: C/C++
Topic: RaspiUtils GPIO using a device driver
Replies: 4
Views: 6600

Re: RaspiUtils GPIO using a device driver

It was pointed out to me that the PI has a free running hardware timer counter register which is pretty useful to have. Also some other people were asking about making IR transmitters and universal remotes out of a PI. I thought of this as well and realized that I could grab the TV listings, parse t...
by Redrobes
Sun Feb 17, 2013 12:12 pm
Forum: General discussion
Topic: IR remote with GPIO port
Replies: 3
Views: 1294

Re: IR remote with GPIO port

Yes it should be tho you may have to send several of the same set of codes in case the Pi gets interrupted or thread switched half way through sending one code. Generally, but not always, the codes are 38KHz modulated pulse position modulation. So you would need to know what code patterns to send fi...
by Redrobes
Fri Feb 15, 2013 1:18 am
Forum: C/C++
Topic: Code execution time
Replies: 23
Views: 7199

Re: Code execution time

I'm not doing DMA and I don't know what I will do with it yet w.r.t writing stuff on gpio and doing fine timing, but I could see examples such as to toggle the gpio line at 38KHz with modulations and make a television remote control. Or maybe I need to send a pulse of a certain size to something whe...
by Redrobes
Thu Feb 14, 2013 1:39 pm
Forum: C/C++
Topic: Code execution time
Replies: 23
Views: 7199

Re: Code execution time

I just verified that free running timer register and it worked like a charm. I would like to use this in the kernel for sending out GPIO transactions with a reasonable time coded properties so this is just the ticket. I ran it against a sleep of 10secs and it came out with something like 10000.52 ms...
by Redrobes
Thu Feb 14, 2013 11:56 am
Forum: C/C++
Topic: Code execution time
Replies: 23
Views: 7199

Re: Code execution time

Thanks joan that looks promising to me - I will look at that one.
by Redrobes
Thu Feb 14, 2013 11:50 am
Forum: C/C++
Topic: Code execution time
Replies: 23
Views: 7199

Re: Code execution time

I think Robert may be wanting a timer of slightly higher resolution than a second if he is doing a PID controller. So if he uses the clock_gettime with the CLOCK_REALTIME would this be a nanosecond or so accurate clock and is this clock asynchronous to the kernel or app. I will ask a similar questio...
by Redrobes
Wed Feb 13, 2013 11:25 am
Forum: C/C++
Topic: Writing code in Visual Studio 2010 vs raspberry pi
Replies: 9
Views: 8281

Re: Writing code in Visual Studio 2010 vs raspberry pi

I'm writing my code on Visual Studio or Notepad++ and saving the files to a shared folder on the pi. I have Putty running ssh shell for the pi and use a makefile to compile it on the pi but from my windows laptop. So I use visual studio and no cross compiler. However you cant compile anything with t...
by Redrobes
Wed Feb 13, 2013 1:02 am
Forum: C/C++
Topic: RaspiUtils GPIO using a device driver
Replies: 4
Views: 6600

Re: RaspiUtils GPIO using a device driver

Just booted the pi to check my files and both the download sources and Makefile I used did not have the + in the extraversion but it worked ok without. Presumably whatever the patch has been applied to does not affect the module installation proc addresses.
by Redrobes
Wed Feb 13, 2013 12:24 am
Forum: C/C++
Topic: RaspiUtils GPIO using a device driver
Replies: 4
Views: 6600

Re: RaspiUtils GPIO using a device driver

I am not exactly sure but I got the sources for the 3.2.27 because that was the kernel version I am currently on and got the config from my current build as a starting config to generate the kernel build files. I don't think that its absolutely necessary to do the full build if you have the correct ...
by Redrobes
Fri Feb 08, 2013 11:12 am
Forum: General programming discussion
Topic: Laser-Tone in Sync - Generator - Possible/complexity?
Replies: 4
Views: 890

Re: Laser-Tone in Sync - Generator - Possible/complexity?

Piece of cake with a microcontroller such as a PIC or maybe an Arduino. You could use a Pi connected up the PIC programmer to write the code and then you program the chip and then it could be accurate up to a few clock cycles of the PIC. The microcontroller would also run on about 100mW and be batte...
by Redrobes
Wed Feb 06, 2013 1:27 pm
Forum: C/C++
Topic: Playing a .WAV file from a C / C++ program
Replies: 8
Views: 8407

Re: Playing a .WAV file from a C / C++ program

If your going to use the GPIO pins and do some hardware interfacing anyway then why not use one more to set the gates of two analog switchs such as in the 4053 or 4066 chip. http://www.technobotsonline.com/4053b-analog-multiplexer-demulti.html http://www.technobotsonline.com/4066b-quad-bilateral-swi...
by Redrobes
Wed Feb 06, 2013 1:06 pm
Forum: General programming discussion
Topic: Rewrite Spectrum prg into IDLE3
Replies: 7
Views: 1049

Re: Rewrite Spectrum prg into IDLE3

You can use SOX to generate tones and append them together like that. So maybe just run the commands and build up a wav file then just play it looping in some kind of media player app. You could check whether there is an already compatible issue of Sox for the raspi with the apt. You can get it for ...
by Redrobes
Sun Feb 03, 2013 2:04 am
Forum: C/C++
Topic: GPIO pin mem-mapping...wait, what?
Replies: 8
Views: 4153

Re: GPIO pin mem-mapping...wait, what?

Now that I *have* read the spec and made up my own driver (see: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=33&t=32152 ) I can now say that the 3 bits specify the mode of the pin and setting it to mode 0 mean the pin is an input. So now the name of the macro makes more sense. If they had set i...
by Redrobes
Sun Feb 03, 2013 1:52 am
Forum: C/C++
Topic: Accessing GPIO
Replies: 3
Views: 2624

Re: Accessing GPIO

Depending on what you want to do I reckon Gordons code will probably be just fine for you and 99% of people but if you absolutely have to feel the need to do it the driver way then I have posted mine which you can use / modify as you see fit. I have included a prebuilt wheezy driver and test app to ...
by Redrobes
Sun Feb 03, 2013 1:22 am
Forum: C/C++
Topic: RaspiUtils GPIO using a device driver
Replies: 4
Views: 6600

RaspiUtils GPIO using a device driver

I have written a device driver for manipulating the GPIO lines directly without going via the memory mapping device. The module decodes some ioctl commands and writes some values to registers of which values have been set up in the parameters to the ioctl. In order to run this code you will need to ...

Go to advanced search