Asked — Edited

Cant Get Pwmrandom Command To Work

Hi all, As a disclaimer I'm very new to writing scripts of any kind. I'm just starting to wright an EZ Script in ARC that will control the motor that rotates the waist back and forth on my full size Lost in Space B9 Robot. So far I've got 2 different scripts working; one to rotate left and the other to rotate right. I've got two scripts just to see if I can write a script to make each direction work. My objective hopefully will be to have one script to control each direction and then bring him back to center.

Anyway, I thought it would be a great idea to have him turn at different speeds each time the command was sent. I can get the basic PWM command to work. Each time I change the speed entry and save the script the new speed will run properly. However when I try the PWMRandom command the speed will not change at all no matter how many times I start the script. Am I doing something wrong?

I'm using this on the second EZ-B board and I do have a "1." in front of the command. Here's the section that's giving me trouble:

################## :RotateLeft 1.PWMRandom(D6, 10, 90) 1.Set(d4, on) 1.Set(d5, off) Return() #################

Again, everything is working except the PWMRandom with no Santx error message.

This is a DC motor controlled with a Pololu VNH5019 H-Bridge useing a pot as a feedback hooked to an ADC port.

Thanks for any help. Dave Schulpius


Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.


Is the motor controller PWM connected to D6 of the second ez-b?


Yes, and when I change the command to just PWM I can get the speed to change.


I've been playing around with this for a while this evening. Just can't get this command to send a random PWM speed to the 2nd board. The regular PWM command works nicely when I use it and even works when I change the value manually in the script.

Could this be a 2nd board thing and not supported? I haven't tried this command on the 1st board yet. It's disconnected and in the other room with B9's upper half. I was wanting to get everything working on the lower half before I stacked him up again. The big guy is heavy.

Is there anyone out there that has a 2 board set up using PWM willing to see if this command works on their bot on the second board? Maybe it's my laptop or something else in the script stoping it.

Thanks, Dave Schulpius


Ahh! DJ's last 12/4/12 update did the trick. All is well now and working! Fantastic service and support. Thanks!

Dave Schulpius :D