Skip to content

Instantly share code, notes, and snippets.

@MakaylaJeffries
Created August 4, 2017 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MakaylaJeffries/b8578bfb0c2425bca0f4af51c205655c to your computer and use it in GitHub Desktop.
Save MakaylaJeffries/b8578bfb0c2425bca0f4af51c205655c to your computer and use it in GitHub Desktop.
digital RC car controlled by mindflex code
#include<Brain.h>
#include<Brain.h>
#include<Brain.h>
#define attention
#define meditation
#define forwardValue
#define backwardValue
#define leftValue
#define rightValue
//#define brain
int forwardPin = 8;
int backwardPin = 9;
int rightPin = 10;
int leftPin = 11;
int attValue;
int medValue;
Brain brain(Serial);
void control(byte attention, byte meditation) {
forwardValue (0);
backwardValue (0);
leftValue(0);
rightValue(0);
}
void setup() {
Serial.begin(9600);
pinMode(forwardPin, OUTPUT);
pinMode(backwardPin, OUTPUT);
pinMode(leftPin, OUTPUT);
pinMode(rightPin, OUTPUT);
}
void loop() {
// unsigned long readMidGamma();
// unsigned long readLowGamma();
// unsigned long readHighBeta();
// unsigned long readLowBeta();
// unsigned long readHighAlpha();
// unsigned long readLowAlpha();
// unsigned long readTheta();
// unsigned long readDelta();
// unsigned long* readPowerArray();
// char* readCSV();
// byte readSignalQuality ();
// byte readAttention ();
// byte readMeditation();
if (brain.update()) {
attValue = (brain.readAttention());
Serial.println(attention);
Serial.println(meditation);
Serial.print("Signal quality:");
Serial.println(brain.readSignalQuality());
Serial.println(brain.readCSV());
// if (attValue > 0)
// {
// digitalWrite(forwardPin, HIGH);
// }
// else
// {
// digitalWrite(forwardPin, LOW);
// }
brain.readMeditation();
if (brain.readSignalQuality() < 25)
{
digitalWrite(forwardPin, HIGH);
}
else
{
digitalWrite(forwardPin, LOW);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment