For bluetooth DNA input: In the code provided, to run the code for bluetooth, replace manualDna(); in the the void loop to be bt(); Serial ports are setup by putting the Serial.begin(9600); code. The code for the bluetooth version is similar to the manual DNA input version. The main difference is that bluetooth input is obtained and then converted into a character array and then the code is identical to the manual DNA input.
Various DNA sequences used in this lab were the Human Chromosome 1:
GATCAATGAGGTGGACACCAGAGGCGGGGACTTGTAAATAACACTGGGCTGTAGGAGTGATGGGGTTC
ACCTCTAATTCTAAGATGGCTAGATAATGCATCTTTCAGGGTTGTGCTTCTATCTAGAAGGTAGAGCT
GTGGTCGTTCAATAAAAGTCCTCAAGAGGTTGGTTAATACGCATGTTTAATAGTACAGTATGGT
Chromosome 2:
AAGCTTAAGCAATTTGGAGAGCCCTCTTTTGGAAAAAGAACACCAAATTAGAAAGTGGGGCTTGGAGG
GAGCACAGCAAATGAAGGGCCCTAAAGCTTAAGCCTTATGAGCACCACTGTAATTCTGCTTTTTGGGA
AACAAGCAAGTAGAACAGTGATGACAATAAAATGTAGTGTGGGCTGATGAGAGATCAGGAGAGT
Chromosome X:
GGTTTCACCATGTTGGCCAGGCTGGCCTCGAACTCCTGACCTCAGGTGATCCGCCTGCCTCAGCCTCCT
AAAGTGCTGGGATTACAGGCGTGAGCCACCACACCCGGCCCCAGATCCCTGTCTTGAGACATAACCTAC
AAGGTGATAGTGTTAAGAGGTGGAGCCCTTTAAGACGTGATGAGGTCATGAGGGTGGGGCCT
DNA robot code
[Demo] Chromosome 1
[Demo] Chromosome 2
[Demo] Chromosome X
#includeSoftwareSerial mySerial(10, 11); String readString; void setup() { //set digital pin 2-6 to be outputs for (int i=2; i<6; i++) { pinMode(i, OUTPUT); } //enabling serial ports for bluetooth addon Serial.begin(9600); mySerial.begin(9600); } void loop(){ manualDna(); } void bt() { while (mySerial.available()) { delay(10); //small delay to allow input buffer to fill char c = mySerial.read(); //gets one byte from serial buffer if (c == ',') { break; } //breaks out of capture loop to print readstring readString += c; } //makes the string readString if (readString.length() >0) { Serial.println(readString); //prints string to serial port out stuff(readString); readString=""; //clears variable for new input } } void stuff(String input) { char dna[input.length()]; //create character array for dna sequence input.toCharArray(dna, input.length()); //filling array with the characters from the String recieved from bluetooth input for (int i=1; i<=sizeof(dna); i++) { if (dna[i] == 'A'){ Serial.println("A"); //forward motor(2); motor(5); } else if(dna[i] == 'T') { Serial.println("T");//backward motor(3); motor(4); } else if(dna[i] == 'G') { Serial.println("G"); //left motor(5); } else if(dna[i] == 'C') { Serial.println("C"); //right motor(2); } else { } delay(50); //delay between each character low(); } delay(1000); //delay after each completion of dna sequence } void motor(int pin) { digitalWrite(pin, HIGH); } void manualDna() { char dna[] = "GGTTTCACCATGTTGGCCAGGCTGGCCTCGAACTCC"; //manually placed dna sequence (this is a small portion of the DNA sequence used for (int i=0; i