What does the Serial method do? [Arduino] - c

I'm translating a program about an RFM Hopper Transmission from Arduino to C, but I'm stuck with the method Serial, since I don't exactly know what it does.
It only appears in the following line, inside the main of the program.
Serial.begin(115200);
I've searched online through the documentation of Arduino and only understand that it's used for comunication between the Arduino board and the other devices.
If cannot use it in my C program though, what am I missing?
https://www.arduino.cc/reference/en/language/functions/communication/serial/
If I can explain anything with more detail from my project please feel free to ask.

Serial is an object, predefined in the Arduino environment, which is in C++ (not C )
To use it, you should call Serial.begin(<baud>); in the setup() function of the Arduino environment, then you can use any method of Serial or the underlying base class
Stream

Related

MPLAB X IDE / XC32 / SAMD21XPlained Pro / printf() not working

I am using a SAMD21XPlained Pro board on Mac (OS Big Sur) with MPLAB X IDE v6.00 (XC32 compiler) and I am currently experiencing a problem when trying to display a message on my terminal via the printf() function.
I am a beginner in embedded programming and I try to follow this tutorial about STDIO Serial Communications : https://www.youtube.com/watch?v=3pwdpYj5s_A&t=397s
Based on this tutorial I first tried to do only a printf() but I didn't see anything on the terminal (I didn't try the scanf() for this first try).
The only thing I changed is that I included the stdio.h file and I did a second test with a baud rate 9600 (because I don't really know how to define the baud rate and I wanted to test like that).
I have read on several forums that the problem comes from the fact that the XC32 compiler uses by default the UART2 while the printf() must use the UART1 to be displayed on the terminal.
Several people suggest to include xc.h to redefine the default UART1 (__XC_UART = 1) but this seems to work only for PIC32MX µCs.
According to my research in the XC32 compiler files, the xc.h file for PIC32MX is not the same as the one for PIC32/SAM and only the one for PIC32MX defines __XC_UART.
I also tried to apply what is proposed in "Microchip Developer Help" for "Redirect stdout for Use With printf()" in the XC32 category:
https://microchipdeveloper.com/xc32:redirect-stdout
The problem is that it also seems to be only for PIC32MX µCs (the p32xxxx.h file that is included at the beginning of the code exists only for PIC32MX in the XC32 compiler).
After a few days of research, I tried many solutions proposed on different forums but I still can't find the one that works so I was wondering if you have an idea?
Thank you !

BIOS interrupt _int86

I'm trying out some old code frome the book "Black art of 3d game programming". I know it is outdated but I started reading it and it's kind of fun and interesting. I downloaded the OpenWatcom C Compiler and made a new DOS Project in order to get this old code even compiled. I already compiled on piece of code where Videomode int13h is set and then I was able to draw pixels to the screen. But this was done with a C function called _setvideomode(). In the following example the videomode is set via the _int86 function which makes the interrupt call and the prototype should be in bios.h, but OpenWatcom says: No prototype found for function _int86. I am stuck now and don't know what to do ;) Here is the code:
void setGraphxMode(int mode){
union REGS inregs,outregs;
inregs.h.ah = 0;
inregs.h.al = (unsigned char)mode;
_int86(0x10,&inregs,&outregs);
}
int main(){
return 0;
}
Would appreciate any advise on this and yes I know: Graphics are done via DirectX or OpenGL these days. This is just for learning purpose! Thank you :)
Under OpenWatcom the call you are looking for is int386 I believe:
int386(0x10, &inregs, &outregs);

Starting Blackfin (BF527)

I am very new in Blackfin processors and I suppose to write a tester program for Blackfin, BF527. This tester program should test the connection of the board and 2 peripheral RAMs.
So far I have downloaded and installed VisualDSP++ (90-day trial version).
Can anyone help me to know how can I write a simple program to write in port G and read From port H, including initialization (preferably in C).
I have looked for sample code on internet but unfortunately all the codes are very advance.
I went through the data sheet, but it was on assembly not C, still I couldn't find any solid sample program for my purpose.
Look in the VisualDSP installation folder (under Program Files). There is lots of sample C and C++ code in Analog Devices\VisualDSP 5.0\Blackfin\Examples
To program the hardware peripherals from C/C++ you need the header files which contain the pointer definitions for the memory-mapped registers. These will be found in Analog Devices\VisualDSP 5.0\Blackfin\include
In your code you can automatically select the correct include file for the project's processor using:
#include <blackfin.h>

Can I use C and ActionScript together?

I'm doing a project where I need to create some kind of GUI for the user as well as control some servo motors.
I'm thinking of using ActionScript for the GUI and C for to control the hardware. Is this even possible? How do I make ActionScipt talk to C and vice-versa?
Obviously the C part will be driving the motors and will send the data to the ActionScript GUI
to be displayed to the user.
Is the above possible? If yes, could someone kindly provide me some pointers?
Thank you very much!
Edit: How do I pass a variable (e.g. x = 5) from ActionScript to be printed in C? Or is this not possible?
"You could go via ASP to a DLL as TG suggested or you could probably call an ANSI C (command line) app and pass in variables (at least on a Windows PC)... that owuld be done using FSCommands. see this tutorial
http://www.actionscripts.org/tutoria...es/index.shtml"
Originally replied by
Jesse Stratford
ActionScript.org Cofounder
This is taken from here
I don`t know the specifics of programming servo motors but basically, if you want some C to AS3 interaction you could do one of the following:
Compile your C/C++ code using flascc.
Wrap your C code in a native extension (if you are targeting AIR).
As sberry suggested - use Sockets.

C code for tone generator in linux

I want to write a c code to generate tone using array output to DAC in ubuntu. (preferably alsa driver)
For example:
I need to be able to send voltage output to DAC like 1100000 etc. to be able to generate a tone. Is it possible?
P.S. I had a look at tones. Is it possible to do that using a c code rather than a bash command?
Something like pcspkr_pcm.c as a starting point perhaps. It is used by (bsvplay, qplay) also from within the hxtools suite.

Resources