I need help to write a program that transmits a series of characters (in C), usi
ID: 3789726 • Letter: I
Question
I need help to write a program that transmits a series of characters (in C), using an Arduino. The sequence will consist of "AlphaNumber", where Alpha is meant to be a letter, cycling from A to Z, and Number is a digit that cycles through 0 to 9. The sequence that comes out should look something like "A0B1C2D3....". The objective is to send a letter-number pair every 500 milliseconds. We will also want to be able to restart the sequence, so we will watch for a capital R to be received and once it comes in, restart the sequence at "AO". Program structure SetUp: Set serial port baud rate. Set up Timer Loop: if 500 milliseconds have passed Send Message Update message if serial data has come in if serial data equal to 'R' Reset message transmission. The baud rate should be 9600 bauds and the code should use the following functions: Serial.begin(baud), Serial.print(), Serial.available(), and Serial.read()Explanation / Answer
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=0;i<=17;i++)
{
j=65;
printf("%c%d",j,i); //for printing alphanumber
j++;
delay(500); //for dealy of 500 milliseconds
if(i==16)
{
i=0;
j=65;
}
}
getch();
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.