Author Topic: Very newbie question:  (Read 2065 times)

0 Members and 1 Guest are viewing this topic.

Offline Techman09Topic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Very newbie question:
« 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.


Offline Rebelgium

  • Supreme Robot
  • *****
  • Posts: 638
  • Helpful? 0
  • It's called the future ... We like it here
Re: Very newbie question:
« Reply #1 on: November 09, 2008, 03:18:26 PM »
What C? what language?
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline Techman09Topic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: Very newbie question:
« Reply #2 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.

Offline Techman09Topic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: Very newbie question:
« Reply #3 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.

Offline ross75

  • Jr. Member
  • **
  • Posts: 9
  • Helpful? 0
Re: Very newbie question:
« Reply #4 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


Offline Trumpkin

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: Very newbie question:
« Reply #5 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);
 
Robots are awesome!

 


Get Your Ad Here