Society of Robots - Robot Forum

Software => Software => Topic started by: Techman09 on November 09, 2008, 02:48:59 PM

Title: Very newbie question:
Post by: Techman09 on November 09, 2008, 02:48:59 PM
How do I set a pin to Hi or Low when outputting to a motor controller or H-bridge???
I am looking for a way to define my drive functions for 4WD inside of the society of robot
"hardware.c" function lists.

I have searched the library documents, but I need some help here.
I am trying to figure out how to make the I/O lines either hi or low.

Thanks.

Title: Re: Very newbie question:
Post by: Rebelgium on November 09, 2008, 03:18:26 PM
What µC? what language?
Title: Re: Very newbie question:
Post by: Techman09 on November 09, 2008, 05:53:03 PM
Using C, trying to alter the files on this site for controlling motors instead of servos.
and the Axon.
Title: Re: Very newbie question:
Post by: Techman09 on November 10, 2008, 04:03:36 PM
something like maybe

PORTE6 = 00000001

or

PORTE6= 1

i amthe code to accomplish this in "C". It seems like this would be so easy to come by, but for some reason, I cannot find anything to manipulate the high or low value for an I/O pin.
Title: Re: Very newbie question:
Post by: ross75 on November 10, 2008, 09:21:18 PM
i dont know about a motor because im very new but i know i can turn a led on and off

 
Code: [Select]
#include <avr/io.h>     

DDRB 0b11111111; // Set all of port b to outputs use 0 for inputs
PORTB 0b01000000; // set pin to high or low using 1 or 0

Title: Re: Very newbie question:
Post by: Trumpkin on November 11, 2008, 05:08:16 PM
Include SoR_Utils.h and then use something like this,
PORT_ON(PORTD, 7);
and
PORT_OFF(PORTD, 7);