ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.

PRO
Canada
#1  

To control LEDs using PWM on connection number 3 with your EZ-B IoTiny, you need to ensure that your script correctly references the specific connection. Here's a step-by-step guide to help you set up and control your LEDs using a script in ARC:

Step 1: Add the EZ-B Connections Skill

  1. Add the EZ-B Connections Skill: Ensure you have added the EZ-B Connections skill to your ARC project.
  2. Configure the Connection: In the EZ-B Connections skill, add a new connection and set it to connection number 3. Enter the IP address or COM port of your EZ-B IoTiny.

Step 2: Add the PWM Slider Skill

  1. Add the PWM Slider Skill: Ensure you have added the PWM Slider skill to your ARC project.
  2. Configure the PWM Slider: In the PWM Slider skill settings, select the digital port to which your LED is connected and set the board number to 3 (since you are using connection number 3).

Step 3: Add the Set Digital Skill

  1. Add the Set Digital Skill: Ensure you have added the Set Digital skill to your ARC project.
  2. Configure the Set Digital Skill: In the Set Digital skill settings, select the digital port to which your LED is connected and set the board number to 3.

Step 4: Write the Script

Now, you need to write a script to control the LEDs using the PWM Slider and Set Digital skills. Here’s an example script in JavaScript:

// Set the PWM value for the LED on connection 3, digital port D0
var pwmValue = 128; // Example PWM value (0-255)
PWM.set(D0, pwmValue, 3); // Set PWM on port D0 of connection 3

// Set the digital port D1 to high (turn on the LED)
Digital.set(D1, true, 3); // Set digital port D1 to high on connection 3

// Set the digital port D2 to low (turn off the LED)
Digital.set(D2, false, 3); // Set digital port D2 to low on connection 3

Explanation:

  • PWM.set(D0, pwmValue, 3): This command sets the PWM value on digital port D0 of connection 3.
  • Digital.set(D1, true, 3): This command sets digital port D1 to high (turns on the LED) on connection 3.
  • Digital.set(D2, false, 3): This command sets digital port D2 to low (turns off the LED) on connection 3.

Step 5: Execute the Script

  1. Add the Script to Your Project: Add the script to your ARC project by creating a new script control.
  2. Run the Script: Execute the script to control your LEDs.

Additional Tips:

  • Check Connections: Ensure that your EZ-B IoTiny is correctly connected and that the IP address or COM port is correctly configured in the EZ-B Connections skill.
  • Test Individual Components: Before running the full script, test each component (PWM Slider and Set Digital) individually to ensure they are working correctly.

By following these steps, you should be able to control your LEDs using PWM and digital signals on connection number 3 with your EZ-B IoTiny. If you have any further questions or run into issues, feel free to ask!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Belgium
#2  

@athena

if i use this PWM.set(D0, pwmValue, 3) its says missing string or wrong values ?

PRO
Canada
#3  

It looks like there might be a syntax issue or a misunderstanding of the parameters for the PWM.set function. Let's correct that and ensure you have the right syntax.

The PWM.set function in ARC requires the following parameters:

  1. The port (as a string, e.g., "D0").
  2. The duty cycle percentage (as a number between 0 and 100).
  3. The optional EZ-B index (if you have multiple EZ-Bs connected).

Here's the corrected example script in JavaScript:

// Set the PWM value for the LED on connection 3, digital port D0
var pwmValue = 50; // Example PWM value (0-100)
PWM.set("D0", pwmValue, 3); // Set PWM on port D0 of connection 3

// Set the digital port D1 to high (turn on the LED)
Digital.set("D1", true, 3); // Set digital port D1 to high on connection 3

// Set the digital port D2 to low (turn off the LED)
Digital.set("D2", false, 3); // Set digital port D2 to low on connection 3

Explanation:

  • PWM.set("D0", pwmValue, 3);: This command sets the PWM value on digital port D0 of connection 3. The port is specified as a string ("D0"), and the PWM value is a number between 0 and 100.
  • Digital.set("D1", true, 3);: This command sets digital port D1 to high (turns on the LED) on connection 3. The port is specified as a string ("D1").
  • Digital.set("D2", false, 3);: This command sets digital port D2 to low (turns off the LED) on connection 3. The port is specified as a string ("D2").

Additional Tips:

  • Ensure that the port names are correctly specified as strings (e.g., "D0", "D1", "D2").
  • The PWM value should be between 0 and 100, representing the duty cycle percentage.
  • The EZ-B index (3 in this case) should match the connection number you are using.

By using the corrected syntax, you should be able to control your LEDs using PWM and digital signals on connection number 3 with your EZ-B IoTiny. If you encounter any further issues, please let me know!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Belgium
#4  

@athena

the problem is allreddy in the first line . what are the missing string and invalid expression ?

Error on line 1: Missing String Quotes or Invalid Expression at index 0: PWM.set(D

PRO
Belgium
#5  

@athena

i'm using ez script . can this be the problem ?

PRO
Canada
#6  

Yes, if you are using EZ-Script, the syntax will be different from JavaScript. Let's correct the script for EZ-Script.

In EZ-Script, the commands for setting PWM and digital values are different. Here is how you can do it:

Example Script in EZ-Script

# Set the PWM value for the LED on connection 3, digital port D0
PWM(D0, 50) # Example PWM value (0-100)

# Set the digital port D1 to high (turn on the LED)
Set(D1, ON)

# Set the digital port D2 to low (turn off the LED)
Set(D2, OFF)

Explanation:

  • PWM(D0, 50): This command sets the PWM value on digital port D0. The value is between 0 and 100.
  • Set(D1, ON): This command sets digital port D1 to high (turns on the LED).
  • Set(D2, OFF): This command sets digital port D2 to low (turns off the LED).

Additional Tips:

  • Ensure that the port names are correctly specified (e.g., D0, D1, D2).
  • The PWM value should be between 0 and 100, representing the duty cycle percentage.

By using the corrected syntax for EZ-Script, you should be able to control your LEDs using PWM and digital signals with your EZ-B IoTiny. If you encounter any further issues, please let me know!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Belgium
#7  

@athena

were do i specifie the conection 3 in here ? pwm(d0,100)

PRO
Canada
#8  

In EZ-Script, you specify the connection index using the BoardIndex command. This command sets the active board index for subsequent commands. Here’s how you can specify connection 3 and set the PWM value for your LEDs:

Example Script in EZ-Script

# Specify the connection index (board index)
BoardIndex(3)

# Set the PWM value for the LED on connection 3, digital port D0
PWM(D0, 100)  # Example PWM value (0-100)

# Set the digital port D1 to high (turn on the LED)
Set(D1, ON)

# Set the digital port D2 to low (turn off the LED)
Set(D2, OFF)

Explanation:

  • BoardIndex(3): This command sets the active board index to 3. All subsequent commands will be sent to the board at connection 3.
  • PWM(D0, 100): This command sets the PWM value on digital port D0 to 100.
  • Set(D1, ON): This command sets digital port D1 to high (turns on the LED).
  • Set(D2, OFF): This command sets digital port D2 to low (turns off the LED).

By using the BoardIndex command, you can specify which connection (board) the subsequent commands should be sent to. This way, you can control the LEDs on connection 3 with your EZ-B IoTiny.

If you encounter any further issues, please let me know!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.