go_away

Author Topic: How to write a byte to digital pins in Arduino?  (Read 2279 times)

0 Members and 1 Guest are viewing this topic.

Offline jocatchTopic starter

  • Jr. Member
  • **
  • Posts: 29
  • Helpful? 0
How to write a byte to digital pins in Arduino?
« on: August 20, 2010, 11:46:20 AM »
Coming from an 8052 background I know how to send a byte to an I/O port. But using C and the Arduino Mega, I am not sure how.

I want to control 2 motors using a motor driver which of course has 2 inputs for each motor and PWM. I know I can used DIGITALWRITE to set a pin but that needs to be done 4 times (or at least 2 times). If I could write one byte (actually a nimble) to some port, I can do it in one statement. Inputs?

Thanks.

JC

Offline jocatchTopic starter

  • Jr. Member
  • **
  • Posts: 29
  • Helpful? 0
Re: How to write a byte to digital pins in Arduino?
« Reply #1 on: August 20, 2010, 12:07:05 PM »
Disregard the above request.

Upon digging alot deeper into the Arduino reference docs, I finally came across the PORTx statement so I am all set. As Gilda Radner would say "Never mind!"

Joe

P.S. Why isn't there a way to delete a post??

Offline amando96

  • Robot Overlord
  • ****
  • Posts: 187
  • Helpful? 1
Re: How to write a byte to digital pins in Arduino?
« Reply #2 on: August 22, 2010, 09:34:04 AM »
Why isn't there a way to delete a post??

If someone now searches what you asked SOR will appear in the search results, and SOR gets more visitors, and since you found the answer, happy visitors  8)
Rorcle, 60% complete
AATV, 5% complete

 


Get Your Ad Here

data_list