Arch Forces

No preview image

1 collaborator

Disco Anuja Doshi (Author)

Tags

(This model has yet to be categorized with any tags)
Model group Stanford-BBA-Spr10 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 4.1 • Viewed 365 times • Downloaded 20 times • Run 1 time
Download the 'Arch Forces' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This model communicates with the sensors and output ports of a GoGo board. A GoGo board is an open source, easy-to-build, low cost, general purpose circuit board designed for educational projects.

This model helps you test your connection to your GoGo board, and serves as a starting point for building NetLogo activities that interact with the physical world.

HOW IT WORKS

The GoGo Extension for NetLogo provides primitives for communicating with a Gogo board

connected to your computer's serial port.

HOW TO USE IT

Connect a GoGo board to your computer's serial port. Then connect sensors, motors and lights to the board.

Press SETUP to begin communicating with the GoGo board. When prompted, enter the name of the serial port that's connected to your board.

Press PING to check if NetLogo is communicating with your GoGo board.

The sensor monitors -- SENSOR 1 through SENSOR 8 -- show the value of each of the sensors on the GoGo board.

The output port controls let you control the motors and lights connected to the output ports of your GoGo board.

A-ON turns the output port(s) on.

A-OFF turns the output port(s) off.

A-THISWAY/THATWAY control the direction of current to the output port(s). If a motor is connected to the output port, this determines the direction of motion.

A-REVERSE reverses the direction of current to the output port(s)

To change the amount of current going to the output port(s), set the A-POWER slider, then press the SET-A-POWER button.

The same applies to the other output ports B, C, and D.

To plot sensor values, set PLOT-SENSOR-1, PLOT-SENSOR-2, and PLOT-SENSOR-3 to the sensors you want to plot. Then press PLOT. At any time, you can clear the plot with the CLEAR-PLOT button. To stop plotting, press PLOT again. To export the data in your plot, right-click (on Macs, control-click) on the plot and choose "Export...".

THINGS TO TRY

Try connecting different sensors to the GoGo board. Temperature sensors, light sensors, pressure sensors.

Connect various motors, lights, and other circuits to the GoGo board's output-ports.

EXTENDING THE MODEL

Modify the plots procedure to plot more than three sensors.

NETLOGO FEATURES

This model uses the NetLogo GoGo Extension. For more information, see the GoGo Extension section of the NetLogo User Manual.

CREDITS AND REFERENCES

To learn about GoGo boards, see http://www.gogoboard.org.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

extensions [gogo]
patches-own [activeregion]
globals [
  serial-port   ;; different on different operating systems
]

to setup
  ca
  set serial-port user-one-of "Select a port:" gogo:ports
  gogo:open serial-port
  repeat 5
  [ if not gogo:ping
    [ user-message "The GoGo Board is not responding." ] ]
  gogo:talk-to-output-ports [ "a" "b" "c" "d" ]
  set-current-plot "Sensors"
  import-pcolors "arch.bmp"
  ask patches [
    set activeregion 0
  ]
  
  ask patch 44 99 [
    ask patches in-radius 12 [
      set activeregion 1
      set pcolor white
    ]
  ]
  
  ask patch 143 -133 [
    ask patches in-radius 12 [
      set activeregion 2
      set pcolor white
    ]
  ]    
end 

to go
  update-patches
end 

to update-patches
      let patch-value1 gogo:sensor 1 / 100
      let patch-value2 gogo:sensor 2 / 100
      
 ask patch 44 99 [
  ask patches in-radius 12 [
      set pcolor scale-color (red - 5) patch-value1 0 10    
  ]
  ]
    
    
 ask patch 143 -133 [ 
   ask patches in-radius 12[  
      set pcolor scale-color (red - 5) patch-value2 0 10  
    
  ]
 ]
end 

to setup-patches
end 

to gogo-ping
  carefully
  [ if not gogo:ping
    [ user-message "Unable to ping GoGo Board." ] ]
  [ user-message error-message ]
end 

to plot-sensor-value [ plot-sensor ]
 if plot-sensor != "none"
 [
   set-current-plot-pen plot-sensor
   if plot-sensor = "sensor 1"
       [ plot (gogo:sensor 1) ]
   if plot-sensor = "sensor 2"
       [ plot (gogo:sensor 2) ]
  ]
end 

to do-plot
  plot-sensor-value plot-sensor-1
  plot-sensor-value plot-sensor-2
  ;; to plot more sensors, add a line like this:
  ;; plot-sensor-value "sensor 5"
end 

; Copyright 2005 Uri Wilensky. This code may be freely copied, distributed,
; altered, or otherwise used by anyone for any legal purpose.

There is only one version of this model, created over 14 years ago by Anuja Doshi.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.