NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include <stdio.h>
#include <bcm2835.h>
#include <inttypes.h>
uint8_t StepCount = 8;
// Sequeential Steps
bool Seq_0[]={0,1,0,0};
bool Seq_1[]={0,1,0,1};
bool Seq_2[]={0,0,0,1};
bool Seq_3[]={1,0,0,1};
bool Seq_4[]={1,0,0,0};
bool Seq_5[]={1,0,1,0};
bool Seq_6[]={0,0,1,0};
bool Seq_7[]={0,1,1,0};
// Sequeential Steps
void forward(bool A[])
{
bcm2835_gpio_write(4,A[0]);
bcm2835_gpio_write(17,A[1]);
bcm2835_gpio_write(23,A[2]);
bcm2835_gpio_write(24,A[3]);
}

int main(int argc, char **argv)
{
if(!bcm2835_init())
return 1;
bcm2835_gpio_fsel(4,BCM2835_GPIO_FSEL_OUTP);
bcm2835_gpio_fsel(17,BCM2835_GPIO_FSEL_OUTP);
bcm2835_gpio_fsel(23,BCM2835_GPIO_FSEL_OUTP);
bcm2835_gpio_fsel(24,BCM2835_GPIO_FSEL_OUTP);
int forward_count;
int backward_count;
int my_delay;
int con = 1;
while(con)
{
printf("Please enter delay time in (ms)");
scanf("%d",&my_delay);
printf("rnPlease enter Forward Count :");
scanf("%d",&forward_count);
printf("rnPlease enter Backward Count :");
scanf("%d",&backward_count);
//Forword act
for(int i=0;i<forward_count;i++)
{
forward(Seq_0);
bcm2835_delay(my_delay);
forward(Seq_1);
bcm2835_delay(my_delay);
forward(Seq_2);
bcm2835_delay(my_delay);
forward(Seq_3);
bcm2835_delay(my_delay);
forward(Seq_4);
bcm2835_delay(my_delay);
forward(Seq_5);
bcm2835_delay(my_delay);
forward(Seq_6);
bcm2835_delay(my_delay);
forward(Seq_7);
bcm2835_delay(my_delay);
}
//Forword act
//Backward act
for(int i=0;i<backward_count;i++)
{
forward(Seq_7);
bcm2835_delay(my_delay);
forward(Seq_6);
bcm2835_delay(my_delay);
forward(Seq_5);
bcm2835_delay(my_delay);
forward(Seq_4);
bcm2835_delay(my_delay);
forward(Seq_3);
bcm2835_delay(my_delay);
forward(Seq_2);
bcm2835_delay(my_delay);
forward(Seq_1);
bcm2835_delay(my_delay);
forward(Seq_0);
bcm2835_delay(my_delay);
}
//Backward act
bcm2835_gpio_write(4,0);
bcm2835_gpio_write(17,0);
bcm2835_gpio_write(23,0);
bcm2835_gpio_write(24,0);
printf("rnDo you want to continue please enter 1, otherwise enter 0 : ");
scanf("%d",&con);
printf("****************************rn");
}
return 0;
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.