Wednesday, March 11, 2015

MuBox update

int sensorPin = A0;        
float sensorValue = 0;
int sensorPinB = A1;        
float sensorValueB = 0;
int sensorPinC=A4;
float sensorValueC=0;
int sensorPinD=A5;
float sensorValueD=0;
float dA=0;
void setup() {
 Serial.begin(9600); 

// Serial.println();
}
void loop() {
  sensorValue = analogRead(sensorPin);
  sensorValue=(sensorValue+analogRead(sensorPin));
   sensorValue=(sensorValue+analogRead(sensorPin));
  sensorValue=(sensorValue+analogRead(sensorPin));
    sensorValue=(sensorValue+analogRead(sensorPin));
   sensorValue=(sensorValue+analogRead(sensorPin));
  sensorValue=(sensorValue+analogRead(sensorPin));
  
if(sensorValue!=0.00){
  
  

  if(sensorValue>1){
    Serial.println("A");
    Serial.println((sensorValue/22)-dA);
    // derivatives: float dA=sensorValue/22;
  }
sensorValue=0;
}
//Lets get one going
  sensorValueB = analogRead(sensorPinB);
  sensorValueB=(sensorValueB+analogRead(sensorPinB));
   sensorValueB=(sensorValueB+analogRead(sensorPinB));
  sensorValueB=(sensorValueB+analogRead(sensorPinB));
    sensorValueB=(sensorValueB+analogRead(sensorPinB));
   sensorValueB=(sensorValueB+analogRead(sensorPinB));
  sensorValueB=(sensorValueB+analogRead(sensorPinB));
if(sensorValueB!=0.00){
  
  

  if(1==1){
    Serial.println("B");
    Serial.println((sensorValueB/22));
  }
sensorValueB=0;
}



//CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC



  sensorValueC = analogRead(sensorPinC);
  sensorValueC=(sensorValueC+analogRead(sensorPinC));
   sensorValueC=(sensorValueC+analogRead(sensorPinC));
  sensorValueC=(sensorValueC+analogRead(sensorPinC));
    sensorValueC=(sensorValueC+analogRead(sensorPinC));
   sensorValueC=(sensorValueC+analogRead(sensorPinC));
  sensorValueC=(sensorValueC+analogRead(sensorPinC));
if(sensorValueC!=0.00){
  
  


    Serial.println("C");
    Serial.println((sensorValueC/22));
  
sensorValueC=0;
}
//Port 4(D)
//Lets get one going
  sensorValueD = analogRead(sensorPinD);
  sensorValueD=(sensorValueD+analogRead(sensorPinD));
   sensorValueD=(sensorValueD+analogRead(sensorPinD));
  sensorValueD=(sensorValueD+analogRead(sensorPinD));
    sensorValueD=(sensorValueD+analogRead(sensorPinD));
   sensorValueD=(sensorValueD+analogRead(sensorPinD));
  sensorValueD=(sensorValueD+analogRead(sensorPinD));
if(sensorValueD!=0.00){
  
  

  if(sensorValueD>200){
    Serial.println("D");
    Serial.println((sensorValueD/22));
  }
sensorValueD=0;
}


}
and the py script which will take data from the different arduinos(2 Unos and a Mega) and route it through Serial, and to some pyCompside continuation script, probably just to log the data fro post proc, or it may be a live stream which displays the computer's analysis such as predicted entry, and pathway, but this may have to wait for the magnet(a very powerful one to keep the radiation in  a region, kind of like in the Tokamarox style reactor).

##script to rec keystrokes from Arduino™
##for linux machines, or install SerialPy
import sys
import serial
Uno=serial.Serial('/dev/AMCY0/',9600);
dUno=serial.Serial('/dev/AMCY1/',9600);
MEGA=serial.Serial('/dev/AMCY2/',9600);



while 1:
 print(Uno.readline());
    print(dUno.readline());
    print(MEGA.readline());



##  char = sys.stdin.read(1)
## Cereal.write(char);

And there is an additional processing sketch for Graphing but that isn't really necessary.


Currently working on the radiation shielding and will post regarding this, and maybe a few of my other projects shortly.

No comments:

Post a Comment