The "void setup()" function is where you initialize variables and pin modes which is run only once after each powerup or reset of the Arduino board.
A "for loop" is used to loop the code within for a specific number of times. The variable "i" is incremented with each cycle until the variable reaches the specified condition. We utilize this variable to control the pins output with the pinMode(i, OUTPUT) method, where the parameter variable "i" is an integer that corresponds to the pin on the Arduino board. The pins can also be configured to be inputs by replacing "OUTPUT" with "INPUT" to the pinMode parameters to look like "pinMode(i, INPUT)".
delay(10) function is used to provide a pause in the operation for 10 milliseconds. (The 10 can be replaced with different values)
digitalWrite(i, LOW) is used to provide a LOW output to the pin "i".
digitalWrite(i, HIGH) is used to provide a HIGH output to the pin "i".
For the DNA robot code, the DNA sequence is stored in a character array and a for loop will cycle through the indexes of the array and compare the character. If the character is an A, a forward movement is provided, if it is T, a backwards movement is provided, if it is a G, a left movement is provided and for C, a right movement is provided. For a forward movement, both motors move forward, for a backwards movement, both motors goes backwards, for a left movement the right motor will move forward only resulting in the robot to go left, and for the right movement, the left motor moves forward to move the robot to the right.