Recently I bought an uTOLED-G20 with the 4D Serial Adaptor. My current hardware connection is the following one (enclosed picture)
My goal is to show the camera in the uTOLED screen. But before to achieve this I would like to send "some picture (.gif, .bmp, .jpg) to the display", or some "Hello world".
Well this task is going me crazy. I was reading http://elinux.org/Serial_port_programming and nothing appears in the uToled.
I want able to develop some software in python or C, c++ in my Linux (RaspberryPI) and show the data in the screen.
Please could you help me from where I can start?
I will really appreciate all your feedback. :-)
The first thing I would do is connect the RX and TX on the RPi together to make sure you are sending and receiving characters on the RPi.
In follow up to the loopback test, you can do this with a few tricks from the command line. Essentially you can #echo "foo" > /dev/ttyAMA0 from one console, and #tail -f from another console. For more specific directions check out this older post: Serial port loopback/duplex test, in Bash or C? (process substitution)
Related
I want to ditch Razer Synapse because it eats up to 600MB of RAM for nothing. I just want to use my macros for two additional keys found on my Razer Deathadder. I've sucessfully captured the HID packets for my Corsair K95 keyboard with C++ HID API and executed my macros, finally was able to say bye bye to iCUE. But I'm not able to open mouse as HID device. Everything should be configured properly, VID/PID, UsagePage and Usage too. But the interesting thing is that wireshark is able to capture the mouse, for me it doesn't for even when I try to open it with admin priveliges. Does somebody have any idea what I should do?
I've tried hidapitester application which is part of HIDAPI C++ library, it automatically closes the device and doesn't receive anything. If it's not possible to solve it in this way, which approach I should use to be able to capture the packets?
Thank you.
so I am trying to use serial so I can view what I output in a serial monitor. But when I plug my pico in and upload my uf2 file that is a while loop that prints hello world and then waits 1 second.
I have tried using the flash nuke .uf2 file but that didnt work and I think I have my cmake file correct as I have the 2 lines `
pico_enable_stdio_usb(Encoder_Test_No_Interrupt 1)
pico_enable_stdio_uart(Encoder_Test_No_Interrupt 0)
`to disable uart and unable usb. I am not sure if there is something I am missing but I find this really confusing. Any help with this would be great.
Thanks in advance,
Dean
edit: If I run hello world and upload via the arduino IDE it works, so I dont think there is anything wrong with my hardware, but rather something I must be doing wrong in the suftware
I'm totally new to programming c++ for Linux, I'd like to make the following;
Console application that would handle and echo the parameters of an incommoding HTTP GET request.
But my first step would be;
So if open a browser and do a;
http://192.168.2.10/?yadda=1
On my linux system on 192.168.2.10, I would get a echo on the screen
New incomming web request parameters: yadda=1
I've done this a few times with .NET with a http listener, but I'm totally clueless on how to do this with C++ in linux.
Thanks for your help!
(No netcat, no vmware under linux running .net with a httplistener, no echo-ing piping, script solution, emulation or whatever, I want to know how to do it in C++ under linux)
In other words;
Dim listener As New HttpListener()
listener.Prefixes.Add("http://localhost/")
Dim context As HttpListenerContext = listener.GetContext
In linux using C++ to create a binairy executable. Some actual lines of c++ code would be helpfull. Thanks
1) You can wire something up pretty quickly with netcat (nc) on Linux without writing any network code.
nc can be run in server mode, and can pipe input / output to another program, like a C++ console program.
2) You can also use inetd / xinetd to turn a console program into a network daemon. You configure your program for a specific port (in the inetd config file) and it does the work of listening for connections, and then execs your C++ program with the socket descriptor duped as the STDIN/STDOUT so you just use standard input / output calls. That, again, lets you write a network program, without knowing sockets. Here is an example: Linux: How to make a daemon/service usable with xinetd?
I would start with option 2, it works, and can get a prototype going within minutes to let you focus on your console echo functionality, then if you really need to later, you can revisit things and write a full network daemon.
3) I just remembered libcurl (http://curl.haxx.se/libcurl/c/), it works well. Thanks to SChepurin for mentioning it in the comments. I have used it on Linux. It is C, but you can wrap it in C++ easier than wrapping the Berkeley API.
Other than that, you are going to be using the Berkeley (BSD) / POSIX sockets (http://en.wikipedia.org/wiki/Berkeley_sockets) calls on Linux, or there may be a nice C++ library out there. I can send you mine offline if you like. The best book I know is the late W. Richard Stevens famous book, UNIX Network Programming, and the related series.
I just thought I'd throw the first 2 ideas out there since you said you weren't sure where to start with C++, it might get you started faster.
I am thinking of implementing a sort of daemon/service in C/C++ for linux, that would communicate with a specific gpib device through shell (using linux-gpib library).
The idea is that the daemon would scan for all existing devices and would create a file/pipe /dev/gpib#-* (where * would be their address on specified gpib bus) for each device. The use would be such as of /dev/com#. I could then type into command-line:
echo "*IDN?" > /dev/gpib1-12
which would send the "*IDN?" string to device 12 on board 1. So far it is a peace of cake...
The problem starts, when I want to retrieve data from the device. I want it to work analogically, so that
cat /dev/gpib1-12
would write out what has the device to say... But I can not know which command, I have sent to the device, would make the device to return a string (value) and which wouldn't. So my options are:
Repeatedly check (while-loop) if the device has anything to reply and send it to the corresponding pipe afterwards.
-or-
Query the device only when the client program attempts to read from the /dev/gpib#-* pipe. This would have to be served through 'signals' and 'waits'.
For obvious reasons (performance and/or latency handicap) I do not want to implement solution 1. I do not know how to do the the other thing though... I feel, that it must be possible to implement on the ol'mighty linux, but how? I did read this and I think that some spin of the function select() is the right way forward, but I can not figure out how to use it for my problem. I also stumbled upon this, where the guy explains how to do something similar, yet sooo different (code mosfet.c).
The question is: how can I immediately detect and react upon an attempt to read from the other side of pipe/FIFO/file via signaling, waiting or interrupts?
Thanx for answers.
PS: It is half past seven in the morning here (yep another sleepless night), so please excuse my broken English...
PPS: Oh yes, and if anyone would already know of such gpib daemon for linux, or if the think I am asking (accessing individual devices through file I/O) would be possible via the linux-gpib library, please let me know. I did read the doc's and src's for linux-gpib, but found nothing helpful. All the linux-gpib library provides are bindings to C, Python, etc.
PPS: Are there maybe other alternatives to using pipes?
If you just need a nice terminal for your gpib device, you can use python (or even better ipython).
linux-gpib comes with python wrappers (for the code look here). so in your shell open python by typing python
In the python interpreter you can easily communicate with the device like this
>>>import Gpib
>>>device = Gpib.Gpib(pad=2)
This opens a connection to the gpib device with the primary address 2. To communicate with it simply do
>>>device.write('*IDN?')
>>>device.read()
'HEWLETT-PACKARD,33120A,0,8.0-5.0-1.0'
To simplify it even further, use ipython instead of plain python. This gives you tab-completion and much more.
After a lot of posts in SO and Google, I could not find an answer to my problem. Most of similar questions are Windows/VB/.Net/C#/Java centric.
I need to send an ESC command to a Zebra USB printer (TTP2130) and get the status back using C/C++ . I am able to print fine (with Zebra generic driver set as default printer) using:
$ lpr file.prn
Used Zebra Toolbox to communicate in Windows and generate *.prn files with ESC commands.
But if I sent a file with a command that needs response from printer, nothing happens.
What would be the best approach to accomplish this? Maybe using libusb1.0 directly?
Thanks for any help!
Found a solution after searching for 'Swecoin'. This is the old manufacturer of Zebra's TTP line of printers. Swecoin on Wikipedia.
This guy made a simple and direct app to communicate with TTP printers (ttputil): http://www.rainbow-software.org/linux/
After downloading and compiling, I was able to send commands directly:
sudo ./ttputil enquiry sensor /dev/usblp0
I will modify its code to fit my needs.
Unfortunately, I haven't found a way to contact (and thank) the original developer from his website.
Well I had a similar issue and in the end this post helped me a lot: https://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/ it is Windows centric but the principle is the same also on Linux and Mac.