Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.