BEST Robotics Forum
Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
widerbestrobot

Junior Member
Registered:
Posts: 23
Reply with quote  #1 
I was wondering how I should go about wiring the limit switches that came in the kit. I would like to get them to work with the limit switch control block in Simulink.
0
gyoung

Administrator
Registered:
Posts: 67
Reply with quote  #2 
Use a 3-pin Screw Terminal Sensor Interface Cable plugged into one of the Cortex's Digital Ports.
Connect your microswitch (Normally Open) between the Ground Pin and the Signal Pin.  That's the two outer screw terminals.
When the switch IS NOT depressed, the value read will be Logic 1. When the switch IS depressed, the value read will be Logic 0.

Capture.JPG 


0
shiremath

Moderator
Registered:
Posts: 78
Reply with quote  #3 
widerbestrobot,

Below is an example of how you would use the LimitSwitchControl block with the limit/reed/bumper switches in Simulink.

Exmpl_limitswitch.PNG    
Note, as gyoung mentioned, the Limit Switch blocks would represent the 'digital' switch(es) on your robot and here 1 represent an open switch and 0 is when closed/pressed. This block is the 'Digital Input' block in the VEX-Simulink library. 

A product block has been used to multiply the output (0 or 1 based on which switch is closed or open AND the incoming Joystick value) from the Limit Switch Control blocks by the Joystick value to obtain the input value to the Motor block.

Try this model and let me know if you have any questions.


-SH





0
widerbestrobot

Junior Member
Registered:
Posts: 23
Reply with quote  #4 
i skipped using the pre-made blocks, and used a Matlab function block. So i could merge my half speed feature, and my limit switch control into five inputs one output. Screenshot 2015-10-14 10.10.48.png  code.png
0
shiremath

Moderator
Registered:
Posts: 78
Reply with quote  #5 
Brilliant work! Thanks for sharing your work here. Does the MATLAB block work as expected?

-SH
0
widerbestrobot

Junior Member
Registered:
Posts: 23
Reply with quote  #6 
They do work as expected, quite well in fact.
0
dannyk

Junior Member
Registered:
Posts: 27
Reply with quote  #7 
Can someone clarify the wiring or post a picture of it. From what I have read, only 2 wires are needed, and they go on the outer prongs of the limit switch, but I cannot find how to tell which goes to which wire in the connector that plugs into the digital slot on the cortex. Does it matter?
Thanks
Danny
0
jgraber

Moderator
Registered:
Posts: 184
Reply with quote  #8 
It doesn't matter.  The limit switch has no polarity, it just shorts the two wires together.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.