Code

Project: jvfeatures

jvtypes.h      jvfeatures.h      chessSeg.cpp      jvtypes.cpp      jvtest.cpp      jvfeatures.cpp     

Project: Other

migrateMailbox.scpt.txt     

Project: Infinite HMM Tutorial

run.m      iHMM_tutorial.zip      HDP_HMM.m      README.txt      ConditionalProbabilityTable.m      HDP.m      HMMProblem.m      HMM.m     

Project: RRT

RRT.h      plot_output.py      RRT.tgz      rrt_test.cpp      RRT.cpp      BidirectionalRRT.cpp      AbstractRRT.cpp     

Project: Box2D_friction_mod

WheelConstraint.h      test_TopDownCar.py      b2FrictionJoint.h      python_friction_joint.patch      test_TopDownFrictionJoint.py      TestEntries.cpp      TopDownCar.h      b2FrictionJoint.cpp      box2d_friction_joint.patch     

Project: Dirichlet Process Mixture Tutorial

EM_GM.m      DP_Demo.m      DPMM.m      DP_Tutorial.zip      DirichletProcess.m      gaussian_EM.m     

Project: Arduino_Code

plot_ardunio_data.sh      Arduino_Code.zip      convert_range2D.py      arduino-serial.c      oscilloscope.sh      oscilloscope.pde      motordriver.pde      helicopter_controller.pde      accelerometer_test.pde      ranger_plane_sweep.pde      clodbuster_controller.pde      pwm_manual.pde      ranger_test.pde      servo_test.pde     

Project: ArduCom

arducom.py      setup.py     

Project: support

geshi.php      Protector.php     

Project: Cogent

CodePane.php      NotesPane.php      PicsPane.php      Cogent.php      PubsTable.php     
Click here to download "resources/code/Arduino_Code/ranger_test/ranger_test.pde"

resources/code/Arduino_Code/ranger_test/ranger_test.pde

#include <stdio.h>

int sensorPin = 4;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int led2Pin = 12;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

int m = -2;
int b = 500;
int ctr = 0;
int ledState;
int pollfreq = 100;
char buf[32];

void setup() {
  // initialize serial port
  Serial.begin(9600);

  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);  
  pinMode(led2Pin, OUTPUT);  
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  delay(pollfreq);

  sprintf(buf,"%d",sensorValue);
  Serial.println(buf);

//  analogWrite(led2Pin,sensorValue);

  if (ctr > (int)(m*sensorValue)+b) {
    ctr = 0;
    if (ledState == 0) {
      digitalWrite(ledPin, HIGH);
      digitalWrite(led2Pin, HIGH);
      ledState = 1;
    }
    else {
      digitalWrite(ledPin, LOW);
      digitalWrite(led2Pin, LOW);
      ledState = 0;
    }
  }
  else {
    ctr += pollfreq;
  }
}




 

About me

Pic of me