robot control v1
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
extensions [ gpio ] to setup ca let i 2 while [ i <= 12 ] [ gpio:set-mode (word "gpio" i) "WRITE" set i i + 2 ] ask patches with [ pxcor < 0 ] [ set pcolor red - 3 ] ask patches with [ pxcor > 0 ] [ set pcolor green - 3 ] reset-ticks end to execute-votes [vote-left vote-right] let vlist get-votelist vote-left vote-right ;show vlist let i 2 while [ i <= 12 ] [ let towrite "LOW" if item (-1 + i / 2) vlist = 1 [ set towrite "HIGH" ] gpio:digital-write (word "gpio" i) towrite ;show (word "gpio:digital-write " (word "gpio" i) towrite) set i i + 2 ] end to-report get-votelist [ vleft vright ] let returnlist n-values 6 [0] if vleft > 0 [ set returnlist replace-item 0 returnlist 1 ] if vright > 0 [set returnlist replace-item 3 returnlist 1 ] let t floor ((abs vleft) / 2) let r (abs vleft) mod 2 set returnlist replace-item 1 returnlist r set returnlist replace-item 2 returnlist t let tr floor ((abs vright) / 2) let rr (abs vright) mod 2 set returnlist replace-item 4 returnlist rr set returnlist replace-item 5 returnlist tr report returnlist end to display-votes [vleft vright] ask patch -5 7 [ set plabel "left" ] ask patch (max-pxcor - 2) 7 [ set plabel "right" ] ask patch -5 -3 [ set plabel vleft ] ask patch (max-pxcor - 2) -3 [ set plabel vright ] end
There are 2 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
robot control v1.png | preview | Preview for 'robot control v1' | over 10 years ago, by Corey Brady | Download |
This model does not have any ancestors.
This model does not have any descendants.