Code

Project: Box2D_friction_mod

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

Project: jvfeatures

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

Project: Other

migrateMailbox.scpt.txt     

Project: Infinite HMM Tutorial

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

Project: Arduino_Code

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

Project: RRT

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

Project: ArduCom

arducom.py      setup.py     

Project: Dirichlet Process Mixture Tutorial

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

Project: support

Protector.php      geshi.php     

Project: Cogent

CodePane.php      Cogent.php      NotesPane.php      PubsTable.php      PicsPane.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