Skip to content

Commit

Permalink
Finished grayscale script
Browse files Browse the repository at this point in the history
- Fixed Arduino sketchbook location. 
- Need to create the ROS Arduino scripts for Graycale & Binary.
  • Loading branch information
MohammadKhan-3 committed Apr 13, 2022
1 parent 2842b74 commit 084047d
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 124 deletions.
252 changes: 131 additions & 121 deletions arduino_control/grayscale/grayscale.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,129 +2,139 @@ int redPin=11;
int greenPin=10;
int bluePin=9;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(redPin,OUTPUT);
pinMode(greenPin,OUTPUT);
pinMode(bluePin,OUTPUT);
}

void loop() {

// put your main code here, to run repeatedly:
//white - using 10x20 Sweep

analogWrite(redPin,5);
analogWrite(greenPin,5);
analogWrite(bluePin,5);
delay(1000); // milisecond

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

analogWrite(redPin,15);
analogWrite(greenPin,15);
analogWrite(bluePin,15);
delay(1000); // milisecond

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

// to reset the arduino board
void setup(){

analogWrite(redPin,25);
analogWrite(greenPin,25);
analogWrite(bluePin,25);
delay(1000); // milisecond

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond


analogWrite(redPin,51);
analogWrite(greenPin,51);
analogWrite(bluePin,51);
delay(1000);

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

analogWrite(redPin,76);
analogWrite(greenPin,76);
analogWrite(bluePin,76);
delay(1000);

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

analogWrite(redPin,102);
analogWrite(greenPin,102);
analogWrite(bluePin,102);
delay(1000);

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

analogWrite(redPin,128);
analogWrite(greenPin,128);
analogWrite(bluePin,128);
delay(1000);

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

analogWrite(redPin,153);
analogWrite(greenPin,153);
analogWrite(bluePin,153);
delay(1000);

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

analogWrite(redPin,179);
analogWrite(greenPin,179);
analogWrite(bluePin,179);
delay(1000);

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

analogWrite(redPin,204);
analogWrite(greenPin,204);
analogWrite(bluePin,204);
delay(1000);
}

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond
void loop(){

analogWrite(redPin,230);
analogWrite(greenPin,230);
analogWrite(bluePin,230);
delay(1000);
}

analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
delay(1000); // milisecond

}
//void setup() {
// // put your setup code here, to run once:
//Serial.begin(9600);
//pinMode(redPin,OUTPUT);
//pinMode(greenPin,OUTPUT);
//pinMode(bluePin,OUTPUT);
//}
//
//void loop() {
//
// // put your main code here, to run repeatedly:
////white - using 10x20 Sweep
//
// analogWrite(redPin,5);
// analogWrite(greenPin,5);
// analogWrite(bluePin,5);
// delay(1000); // milisecond
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
// analogWrite(redPin,15);
// analogWrite(greenPin,15);
// analogWrite(bluePin,15);
// delay(1000); // milisecond
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
//
// analogWrite(redPin,25);
// analogWrite(greenPin,25);
// analogWrite(bluePin,25);
// delay(1000); // milisecond
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
//
// analogWrite(redPin,51);
// analogWrite(greenPin,51);
// analogWrite(bluePin,51);
// delay(1000);
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
// analogWrite(redPin,76);
// analogWrite(greenPin,76);
// analogWrite(bluePin,76);
// delay(1000);
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
// analogWrite(redPin,102);
// analogWrite(greenPin,102);
// analogWrite(bluePin,102);
// delay(1000);
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
// analogWrite(redPin,128);
// analogWrite(greenPin,128);
// analogWrite(bluePin,128);
// delay(1000);
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
// analogWrite(redPin,153);
// analogWrite(greenPin,153);
// analogWrite(bluePin,153);
// delay(1000);
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
// analogWrite(redPin,179);
// analogWrite(greenPin,179);
// analogWrite(bluePin,179);
// delay(1000);
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
// analogWrite(redPin,204);
// analogWrite(greenPin,204);
// analogWrite(bluePin,204);
// delay(1000);
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
// analogWrite(redPin,230);
// analogWrite(greenPin,230);
// analogWrite(bluePin,230);
// delay(1000);
//
// analogWrite(redPin,0);
// analogWrite(greenPin,0);
// analogWrite(bluePin,0);
// delay(1000); // milisecond
//
//}
2 changes: 1 addition & 1 deletion msg/GrayScale.msg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This message contains the state of a single RGB.
# (0) turns off the RGB
# (0,0,0) turns off the RGB
#

uint8 red # red channel
Expand Down
2 changes: 1 addition & 1 deletion scripts/RGB_no_descartes_robot_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def main():
move_robot = True # set equal to False to not move robot

# init node & Publishers
pub_rgb_values = rospy.Publisher('paintbrush_color',RGBState, queue_size=5)
pub_rgb_values = rospy.Publisher('/paintbrush_color',RGBState, queue_size=5)
rospy.init_node('picasso')
rospy.loginfo(">>picasso node successfully created")
rospy.Rate(1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/grayscale_no_descartes_robot_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def main():
move_robot = True # set equal to False to not move robot

# init node & Publishers
pub_GS_values = rospy.Publisher('paintbrush_grayscale',GrayScale, queue_size=1)
pub_GS_values = rospy.Publisher('/paintbrush_grayscale',GrayScale, queue_size=1)
rospy.init_node('grayscale')
rospy.loginfo(">>grayscale node successfully created")
rospy.Rate(1)
Expand Down

0 comments on commit 084047d

Please sign in to comment.