Script Collection icon Script Collection — Manage and execute multiple scripts in a single Script Manager using ControlCommand(), with Control Details showing available commands. Try it →

ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

Author Avatar
Australia
#9  

hi DJ it would not do a right()?

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#10  

Strange. Works in my test when I wrote it.

Author Avatar
Australia
#11  

hi DJ i'll play with the timing of the scan etc.

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#13  

Ah you know what? Maybe don't have it move from 10 to 80 because that might be what's happening. Have it move from 10 to 40. The. 40 to 80. Then 80 to 40. Then 40 to 10.

Repeat

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#14  

Also, if you get the latest ARC... There is a C# example for a radar control. Look under File -> Examples -> Script C Radar Control

Author Avatar
Australia
#15  

hi DJ Thanks i did a little mod:)

  1. it move forward after turning
  2. scan rate is faster
  3. it works

using System;
using System.IO;
using System.Windows.Forms;
using EZ_B;

namespace VName {

  public class VClass {

    public void Main(EZB ezb0, EZB ezb1, EZB ezb2, EZB ezb3, EZB ezb4) {

      bool dir     = true;
      bool weMoved = false;

      ezb0.Servo.SetServoPosition(Servo.ServoPortEnum.D5, 10);
      
      while (true) {
      
        int servoPos = ezb0.Servo.GetServoPosition(Servo.ServoPortEnum.D5);
        int distance = ezb0.HC_SR04.GetValue(Digital.DigitalPortEnum.D0, Digital.DigitalPortEnum.D1);
 
        if (distance  40)
            ezb0.Movement.GoRight();
          else if (servoPos  80)
            dir = false;
        
          if (servoPos < 10)
            dir = true;

          ezb0.Servo.SetServoPosition(Servo.ServoPortEnum.D5, servoPos);
        }

        System.Threading.Thread.Sleep(250);
      }
    }
  }
}