Society of Robots - Robot Forum

Software => Software => Topic started by: jocatch on August 20, 2010, 11:46:20 AM

Title: How to write a byte to digital pins in Arduino?
Post by: jocatch 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
Title: Re: How to write a byte to digital pins in Arduino?
Post by: jocatch 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??
Title: Re: How to write a byte to digital pins in Arduino?
Post by: amando96 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)