The first part seemed to paste ok.
The second part I may have pasted in the wrong spot but I am getting the following error message “The value of the local variable “filename” is not used”.
The first part seemed to paste ok.
The second part I may have pasted in the wrong spot but I am getting the following error message “The value of the local variable “filename” is not used”.
"/example.txt"
needs to be replaced with
"/" + filename
(The forum is showing things in red where there is a / - ignore the colour)
Awesome that worked!
Is there a way for me to add headers as the first row of each file? Such as Date, Machine1 name, Machine2 name, etc…?
Yes. Make a string with the machine names. At the top of the prog, with your other variables.
String machineNames = "Press 2a, Press 2b, ... ";
We need to detect if the file exists. Have to do this after we know the name, and before we open it. Then after we’ve opened the file, if it didn’t exist, write the title line. I didn’t know how to check if a file exists but @GoToLoop has done it. Put this after the other functions we added earlier.
boolean fileExists(String filename) {
File f = dataFile(filename);
String filePath = f.getPath();
boolean exist = f.isFile();
println(filePath, exist);
return exist;
}
Put this after we made the filename with the date in it.
boolean csvFileExists
csvFileExists = fileExists("@sketchPath + "/" + filename")
(that has to be the same filespec as in the open, we should rationalise that but never mind now.) After the open we need to conditionally write the new line.
if (!csvFileExists) {
output.write("DateTime," + machineNames);
}
I added the “boolean fileExists…” code near the top below the “String dateForFilename()…” which im assuming is the function you were talking about we added earlier?
Just a bit confused as to where to add these
Correct. Those are separate functions that have nothing specific to the machine values logging. If you wanted, you could test or use them in a separate sketch.
I added them to a separate sketch to test and am receiving the following errors.
Syntax Error - Error on “ csvFileExists”
Syntax Error - Missing operator, semicolon, or ‘}’ near ‘if’?
It wants a ; on the end of line 10 as shown. The ; completes the statement.
There is another issue, and the printed error for it is confusing. Processing does not let you have functions, and executable code that is not in a function. Add these lines to your test program:
void setup() {
}
void draw() {
}
Then move your test code, lines 10 to 14 as shown, inside the setup function. i.e. inside { }.
Good morning @RichardDL, hope you had a great weekend.
I have added and adjusted the lines. I am now receiving a syntax error on line 13. See below.
line 11 needs a ; on the end. (It’s easier if you post text copy of your code. Then I or anyone can easily copy into Processing and see the same error.)
I added the ; and am now receiving the following errors. I have copy and pasted the code, thank you for the advise.
Line 15:
The operator / is undefined for the argument type(s) java.lang.String, java.lang.String
Line18:
The name “output” cannot be recognized
String machineNames = "DATE, PRESS 2, PRESS 3, PRESS 4, PRESS 5, PRESS 6, CC SAW 1, CC SAW 2, CC SAW 3, ROBOT 1, ROBOT 2, ROBOT 3, RIVETER 3, RIVETER 4, RIVETER 6, WELDER 4, WELDER 5, SYSTEM 5-8, BROACHER, HEADER";
boolean fileExists(String filename) {
File f = dataFile(filename);
String filePath = f.getPath();
boolean exist = f.isFile();
println(filePath, exist);
return exist;
}
boolean csvFileExists;
void setup() {
csvFileExists = fileExists("@sketchPath + "/" + filename");
if (!csvFileExists) {
output.write("DateTime," + machineNames);
}
}
void draw() {
There are some extra quotes, might have been my error. Try this
csvFileExists = fileExists(@sketchPath + "/" + filename);
The ‘output…’ error is because you’ve copied the output line but without the lines that open and close the file. If this is just a test program to demonstrate the fileExists function you could replace it with
println("File doesn't exist");
You’re going to have to start developing some fault-finding tricks for yourself.
Thanks again for your help @RichardDL. I have made the adjustments.
After some trial and error what ended up working was adding quotations to each one as seen below.
csvFileExists = fileExists("@sketchPath" + "/" + "filename");
I was also having an issue with the machineNames being displayed on the same line as the numbers. I remembered that we added a “\n” for the String.format to create a new line so i also added “\n” to the end of my machineNames line which is now creating a new line.
String machineNames = "DATE, PRESS 2, PRESS 3, PRESS 4, PRESS 5, PRESS 6, CC SAW 1, CC SAW 2, CC SAW 3, ROBOT 1, ROBOT 2, ROBOT 3, RIVETER 3, RIVETER 4, RIVETER 6, WELDER 4, WELDER 5, SYSTEM 5-8, BROACHER, HEADER\n";
Now the only issue left that i am having is it adds the machineNames to every second line in the file as seen in the image below. However i only need it on the top (first line) of each daily file.
Hi @Jason, That line you posted with “filename”, the quotes should not be there. It seems to work, because it is using the word filename as text i.e. looking for the file …\filename which does not exist. With the quotes removed it will use the contents of the variable called filename. This file should exist, and it should not add the machine names each time.
Oh ok that makes sense. I have removed the quotations from @sketchpath and filename. Once I did that I was once again receiving a Syntax Error on that same line. After some fooling around what I ended up doing was changing the “@sketchPath” name to “sketchPath()”, so I removed the “@” symbol and added “()” after it and it ended up working so far.
So I left the program running overnight to test it out. Everything seems to be working fine aside from 1 issue that has now come to my attention. I need the counts to reset everyday a new file is made. Right now it created a new file for today however the counts are continuing from the previous file from yesterday.
Hi @RichardDL, hope all is well. I have tried fiddling around with being able to reset the count to 0 every time a new file is created however I have had no luck. I can do this manually by pressing the “Reset All” button on the UI (image attached) but I can’t seem to figure out how to have it reset automatically. Any assistance would be greatly appreciated.
Very sorry for delay, I wrote this a few days ago, failed to finish it and press ‘Reply’
There are two steps to this, make a function that resets all the values, and run that function at the right moment. In your original post lines 315…350 reset all the values. Move all those lines inside a new function.
void ResetAll() {
p5c1=0;
...
headerc2 = 0;
}
In the original place where those lines were, put this:
ResetAll();
Now the program works as it did before, the reset function is available to be run at midnight, and we haven’t added lots of code. How are we going to run that? Hmm…
// The action every timePeriod:
// all the logging to file actions.
int hours;
hours = LocalDateTime.now().getHour();
print(String.format("tC %2d, Hr %2d, DateTime %s", timeCount1, hours, dateStamp()));
if (hours == 0 && timeCount1 == 0) {
resetAll();
}
I was going to say put this before logging to file. Then realised that this would throw away all the counts between 23:30 and 00:00. An alternative is to reset after 23:30.
if (hours == 23 && timeCount1 == 1)
I think that might be better. There is another possible issue, that I think won’t bother you. Have you noticed that when you start the program it logs, at whatever time it is? By the same reasoning, if you start the program any time in the 30 min period after the designated reset time, it will reset.
Apologies for the super late reply. I was using the program manually resetting for the past few months because i could not figure out how to have it reset automatically. I made the adjustments that were suggested above however it does not reset them all to 0 at any time, it continues from the the number from the previous day. I have attached the full code below. Any assistance would be greatly appreciated, thank you in advance.
import processing.serial.*;
import java.io.FileWriter;
FileWriter output;
import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;
String dateStamp() {
// return the date in specified format.
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
return dtf.format(now);
}
String dateForFilename() {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMdd");
LocalDateTime now = LocalDateTime.now();
return dtf.format(now);
}
boolean fileExists(String filename) {
File f = dataFile(filename);
String filePath = f.getPath();
boolean exist = f.isFile();
println(filePath, exist);
return exist;
}
String machineNames = "PRESS 2, PRESS 3, PRESS 4, PRESS 5, PRESS 6, CC SAW 1, CC SAW 2, CC SAW 3, ROBOT 1, ROBOT 2, ROBOT 3, RIVETER 3, RIVETER 4, RIVETER 6, WELDER 4, WELDER 5, SYSTEM 5-8, BROACHER, HEADER\n";
int[] xbdata = new int [19];//set up array for API data from xbee
int count = 0; //integer used to find places of data in transmission
int p2c1 = 0;
int p2c2 = 0;
int p3c1 = 0;
int p3c2 = 0;
int p4c1 = 0;
int p4c2 = 0;
int p5c1 = 0;
int p5c2 = 0;
int p6c1 = 0; // integer used for press 6 count
int p6c2 = 0; //set up second integer for p6 count
int time = millis(); //integer used for timing
int time2 = 0; //integer used for timing
int cntbyte = 0;
int ccs1c1 = 0;
int ccs1c2 = 0;
int ccs2c1 = 0;
int ccs2c2 = 0;
int ccs3c1 = 0;
int ccs3c2 = 0;
int ccs4c1 = 0;
int ccs4c2 = 0;
int rob1c1 = 0;
int rob1c2 = 0;
int rob2c1 = 0;
int rob2c2 = 0;
int rob3c1 = 0;
int rob3c2 = 0;
int riv3c1 = 0;
int riv3c2 = 0;
int riv4c1 = 0;
int riv4c2 = 0;
int riv6c1 = 0;
int riv6c2 = 0;
int weld4c1 = 0;
int weld4c2 = 0;
int weld5c1 = 0;
int weld5c2 = 0;
int sys58c1 = 0;
int sys58c2 = 0;
int broachc1 = 0;
int broachc2 = 0;
int headerc1 = 0;
int headerc2 = 0;
int timePeriod = 30; // Set the time period
int timeCount0 = -1;
int timeCount1;
Serial myPort; // The serial port
void setup() {
size(500,900); //sets up size of total area
// List all the available serial ports help find usb port to computer
println(Serial.list());
// Open the port you are using at the rate you want:
myPort = new Serial(this, "COM3", 9600);
frameRate(1);
println(sketchPath());
}
void draw()
{
background(90,90);
// count = 0;
if ( mouseY > 10 && mouseY < 30 && //test for curson on leftmost character of press 6 count b
mouseX > 99 && mouseX < 110 //and mouse button pressed
&& mousePressed)
{
p2c1 = 0;
}
if ( mouseY > 40 && mouseY < 60 && // test for cursor on leftmost character of press6 count a
mouseX > 99 && mouseX < 110 // and mouse button pressed resets count
&& mousePressed)
{
p2c2 = 0;
}
if ( mouseY > 150 && mouseY < 170 && //test for curson on leftmost character of press 6 count b
mouseX > 99 && mouseX < 110 //and mouse button pressed
&& mousePressed)
{
p4c1 = 0;
}
if ( mouseY > 180 && mouseY < 200 && // test for cursor on leftmost character of press6 count a
mouseX > 99 && mouseX < 110 // and mouse button pressed resets count
&& mousePressed)
{
p4c2 = 0;
}
if ( mouseY > 224 && mouseY < 240 && //test for curson on leftmost character of press 6 count b
mouseX > 99 && mouseX < 110 //and mouse button pressed
&& mousePressed)
{
p5c1 = 0;
}
if ( mouseY > 255 && mouseY < 270 && // test for cursor on leftmost character of press6 count a
mouseX > 99 && mouseX < 110 // and mouse button pressed resets count
&& mousePressed)
{
p5c2 = 0;
}
if ( mouseY > 324 && mouseY < 340 && //test for curson on leftmost character of press 6 count b
mouseX > 99 && mouseX < 110 //and mouse button pressed
&& mousePressed)
{
p6c2 = 0;
}
if ( mouseY > 294 && mouseY < 310 && // test for cursor on leftmost character of press6 count a
mouseX > 99 && mouseX < 110 // and mouse button pressed resets count
&& mousePressed)
{
p6c1 = 0;
}
if ( mouseY > 423 && mouseY < 440 && //test for curson on leftmost character of press 6 count b
mouseX > 140 && mouseX < 150 //and mouse button pressed
&& mousePressed)
{
ccs1c2 = 0;
}
if ( mouseY > 394 && mouseY < 410 && // test for cursor on leftmost character of press6 count a
mouseX > 140 && mouseX < 150 // and mouse button pressed resets count
&& mousePressed)
{
ccs1c1 = 0;
}
if ( mouseY > 494 && mouseY < 510 && //test for curson on leftmost character of press 6 count b
mouseX > 140 && mouseX < 150 //and mouse button pressed
&& mousePressed)
{
ccs2c2 = 0;
}
if ( mouseY > 463 && mouseY < 480 && // test for cursor on leftmost character of press6 count a
mouseX > 140 && mouseX < 150 // and mouse button pressed resets count
&& mousePressed)
{
ccs2c1 = 0;
}
if ( mouseY > 563 && mouseY < 580 && //test for curson on leftmost character of press 6 count b
mouseX > 140 && mouseX < 150 //and mouse button pressed
&& mousePressed)
{
ccs3c2 = 0;
}
if ( mouseY > 533 && mouseY < 550 && // test for cursor on leftmost character of press6 count a
mouseX > 140 && mouseX < 150 // and mouse button pressed resets count
&& mousePressed)
{
ccs3c1 = 0;
}
if ( mouseY > 12 && mouseY < 30 && // test for cursor on leftmost character of press6 count a
mouseX > 392 && mouseX < 405 // and mouse button pressed resets count
&& mousePressed)
{
rob1c1 = 0;
}
if ( mouseY > 42 && mouseY < 60 && // test for cursor on leftmost character of press6 count a
mouseX > 392 && mouseX < 405 // and mouse button pressed resets count
&& mousePressed)
{
rob1c2 = 0;
}
if ( mouseY > 82 && mouseY < 100 && // test for cursor on leftmost character of press6 count a
mouseX > 392 && mouseX < 405 // and mouse button pressed resets count
&& mousePressed)
{
rob2c1 = 0;
}
if ( mouseY > 112 && mouseY < 130 && // test for cursor on leftmost character of press6 count a
mouseX > 392 && mouseX < 405 // and mouse button pressed resets count
&& mousePressed)
{
rob2c2 = 0;
}
if ( mouseY > 152 && mouseY < 170 && // test for cursor on leftmost character of press6 count a
mouseX > 392 && mouseX < 405 // and mouse button pressed resets count
&& mousePressed)
{
rob3c1 = 0;
}
if ( mouseY > 182 && mouseY < 200 && // test for cursor on leftmost character of press6 count a
mouseX > 392 && mouseX < 405 // and mouse button pressed resets count
&& mousePressed)
{
rob3c2 = 0;
}
if ( mouseY > 221 && mouseY < 240 && // test for cursor on leftmost character of press6 count a
mouseX > 409 && mouseX < 422 // and mouse button pressed resets count
&& mousePressed)
{
riv3c1 = 0;
}
if ( mouseY > 251 && mouseY < 271 && // test for cursor on leftmost character of press6 count a
mouseX > 409 && mouseX < 422 // and mouse button pressed resets count
&& mousePressed)
{
riv3c2 = 0;
}
if ( mouseY > 291 && mouseY < 310 && // test for cursor on leftmost character of press6 count a
mouseX > 409 && mouseX < 422 // and mouse button pressed resets count
&& mousePressed)
{
riv4c1 = 0;
}
if ( mouseY > 321 && mouseY < 340 && // test for cursor on leftmost character of press6 count a
mouseX > 409 && mouseX < 422 // and mouse button pressed resets count
&& mousePressed)
{
riv4c2 = 0;
}
if ( mouseY > 361 && mouseY < 380 && // test for cursor on leftmost character of press6 count a
mouseX > 409 && mouseX < 422 // and mouse button pressed resets count
&& mousePressed)
{
riv6c1 = 0;
}
if ( mouseY > 391 && mouseY < 410 && // test for cursor on leftmost character of press6 count a
mouseX > 409 && mouseX < 422 // and mouse button pressed resets count
&& mousePressed)
{
riv6c2 = 0;
}
if ( mouseY > 430 && mouseY < 450 && // test for cursor on leftmost character of press6 count a
mouseX > 399 && mouseX < 412 // and mouse button pressed resets count
&& mousePressed)
{
weld4c1 = 0;
}
if ( mouseY > 460 && mouseY < 480 && // test for cursor on leftmost character of press6 count a
mouseX > 399 && mouseX < 412 // and mouse button pressed resets count
&& mousePressed)
{
weld4c2 = 0;
}
if ( mouseY > 500 && mouseY < 520 && // test for cursor on leftmost character of press6 count a
mouseX > 399 && mouseX < 412 // and mouse button pressed resets count
&& mousePressed)
{
weld5c1 = 0;
}
if ( mouseY > 530 && mouseY < 550 && // test for cursor on leftmost character of press6 count a
mouseX > 399 && mouseX < 412 // and mouse button pressed resets count
&& mousePressed)
{
weld5c2 = 0;
}
if ( mouseY > 570 && mouseY < 590 && // test for cursor on leftmost character of press6 count a
mouseX > 409 && mouseX < 422 // and mouse button pressed resets count
&& mousePressed)
{
sys58c1 = 0;
}
if ( mouseY > 600 && mouseY < 620 && // test for cursor on leftmost character of press6 count a
mouseX > 409 && mouseX < 422 // and mouse button pressed resets count
&& mousePressed)
{
sys58c2 = 0;
}
if ( mouseY > 640 && mouseY < 660 && // test for cursor on leftmost character of press6 count a
mouseX > 390 && mouseX < 402 // and mouse button pressed resets count
&& mousePressed)
{
broachc1 = 0;
}
if ( mouseY > 670 && mouseY < 690 && // test for cursor on leftmost character of press6 count a
mouseX > 390 && mouseX < 402 // and mouse button pressed resets count
&& mousePressed)
{
broachc2 = 0;
}
if ( mouseY > 710 && mouseY < 730 && // test for cursor on leftmost character of press6 count a
mouseX > 379 && mouseX < 391 // and mouse button pressed resets count
&& mousePressed)
{
headerc1 = 0;
}
if ( mouseY > 740 && mouseY < 760 && // test for cursor on leftmost character of press6 count a
mouseX > 379 && mouseX < 391 // and mouse button pressed resets count
&& mousePressed)
{
headerc2 = 0;
}
//Test for click on reset all square
if ( mouseY > 732 && mouseY < 750 && // test for cursor on reset all square
mouseX > 165 && mouseX < 185 // and mouse button pressed resets all counts
&& mousePressed)
{
// The action every timePeriod:
int hours;
hours = LocalDateTime.now().getHour();
print(String.format("tC %2d, Hr %2d, DateTime %s", timeCount1, hours, dateStamp()));
if (hours == 23 && timeCount1 == 1) {
ResetAll();
}
}
if (myPort.available() > 0) //data available on port if > 0
{
int inByte = myPort.read(); //load bytes one by one into array
// if (xbdata[0] = 126) {
// count = 0;}
count ++;
xbdata[count]=inByte;
println(inByte);
if (xbdata[1] != 126) {count = 0;
}
// count = 0;}
if (count > 17) {
count = 0;}
if (xbdata[16]==67)
{
ccs1c1 ++;
ccs1c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==66)
{
ccs2c1 ++;
ccs2c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==65)
{
p6c1 ++;
p6c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==70)
{
p5c1 ++;
p5c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==71)
{
p2c1 ++;
p2c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==72)
{
p4c1 ++;
p4c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==68)
{
ccs3c1 ++;
ccs3c2 ++;
//count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==50)
{
rob1c1 ++;
rob1c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==51)
{
rob2c1 ++;
rob2c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==52)
{
rob3c1 ++;
rob3c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==42)
{
riv6c1 ++;
riv6c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==41)
{
riv4c1 ++;
riv4c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==40)
{
riv3c1 ++;
riv3c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==31)
{
weld4c1 ++;
weld4c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==30)
{
weld5c1 ++;
weld5c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==81)
{
sys58c1 ++;
sys58c2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==80)
{
broachc1 ++;
broachc2 ++;
count = 0;
xbdata[16] = 0;
}
if (xbdata[16]==82)
{
headerc1 ++;
headerc2 ++;
count = 0;
xbdata[16] = 0;
}
// time2 = millis();
// if (time2 > (time + 1000)){
// background(200,75,80);
// For final:
//timeCount1 = LocalDateTime.now().getMinute();
// For faster testing:
timeCount1 = LocalDateTime.now().getSecond();
timeCount1 /= timePeriod;
if (timeCount1 != timeCount0) {
try {
String textLine;
String dateString;
String filename;
filename = String.format("Machine_Counts_%s.csv", dateForFilename());
boolean csvFileExists;
csvFileExists = fileExists(sketchPath() + "/" + filename);
dateString = dateStamp();
textLine = String.format("%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
dateString, p2c1, p3c1, p4c1, p5c1, p6c1, ccs1c1, ccs2c1, ccs3c1, rob1c1, rob2c2, rob3c1, riv3c1, riv4c1, riv6c1, weld4c1, weld5c1, sys58c1, broachc1, headerc1) ;
output = new FileWriter(sketchPath() + "/" + filename, true);
// true = append (create if not there),
// false = create new (delete if already there)
if (!csvFileExists) {
output.write("DateTime," + machineNames);
}
output.write(textLine);
output.flush();
output.close();
}
catch(IOException e) {
println("It broke!!!");
e.printStackTrace();
}
println(dateStamp());
timeCount0 = timeCount1;
}
}
textSize (20);
text ("Press 2a",10,30);
text ("Press 2b" ,10, 60);
fill(245,71,20);
text (p2c1,100,30);
text (p2c2,100,60);
fill (230);
text ("Press 3a",10,100);
text ("Press 3b",10,130);
fill(245,71,20);
text (p3c1,100,100);
text (p3c2,100,130);
fill (230);
text ("Press 4a",10,170);
text ("Press 4b",10,200);
fill(245,71,20);
text (p4c1,100,170);
text (p4c2,100,200);
fill (230);
text ("Press 5a",10,240);
text ("Press 5b",10,270);
fill(245,71,20);
text (p5c1,100,240);
text (p5c2,100,270);
fill (230);
text ("CC Saw #1a" ,10, 410);
text ("CC Saw #1b" ,10, 440);
fill(245,71,20);
text (ccs1c1,140,410);
text (ccs1c2,140,440);
fill (230);
text ("CC Saw #2a" ,10, 480);
text ("CC Saw #2b" ,10, 510);
fill(245,71,20);
text (ccs2c1,140,480);
text (ccs2c2,140,510);
fill (230);
text ("CC Saw #3a" ,10, 550);
text ("CC Saw #3b" ,10, 580);
fill(245,71,20);
text (ccs3c1,140,550);
text (ccs3c2,140,580);
fill (230);
text ("Press 6a" ,10, 310);
text ("Press 6b" ,10, 340);
fill(245,71,20);
text (p6c1,100,310);
text (p6c2,100,340);
fill (230);
text ("Robot1a",300,30);
text ("Robot1b" ,300, 60);
fill(245,71,20);
text (rob1c1,395,30);
text (rob1c2,395,60);
fill (230);
text ("Robot2a",300,100);
text ("Robot2b" ,300,130);
fill(245,71,20);
text (rob2c1,395,100);
text (rob2c2,395,130);
fill (230);
text ("Robot3a",300,170);
text ("Robot3b" ,300,200);
fill(245,71,20);
text (rob3c1,395,170);
text (rob3c2,395,200);
fill (230);
text ("Riveter3a",300,240);
text ("Riveter3b",300,270);
fill(245,71,20);
text (riv3c1,410,240);
text (riv3c2,410,270);
fill (230);
text ("Riveter4a",300,310);
text ("Riveter4b",300,340);
fill(245,71,20);
text (riv4c1,410,310);
text (riv4c2,410,340);
fill (230);
text ("Riveter6a",300,380);
text ("Riveter6b",300,410);
fill(245,71,20);
text (riv6c1,410,380);
text (riv6c2,410,410);
fill (230);
text ("Welder4a",300,450);
text ("Welder4b",300,480);
fill(245,71,20);
text (weld4c1,400,450);
text (weld4c2,400,480);
fill (230);
text ("Welder5a",300,520);
text ("Welder5b",300,550);
fill(245,71,20);
text (weld5c1,400,520);
text (weld5c2,400,550);
fill (230);
text ("System58",300,590);
text ("System58",300,620);
fill(245,71,20);
text (sys58c1,410,590);
text (sys58c2,410,620);
fill (230);
text ("Broacher",300,660);
text ("Broacher",300,690);
fill(245,71,20);
text (broachc1,390,660);
text (broachc2,390,690);
fill (230);
text ("Header",300,730);
text ("Header",300,760);
fill(245,71,20);
text (headerc1,380,730);
text (headerc2,380,760);
fill (230);
text ("Reset ALL",25,750);
rect (165,732,20,20);
// text ("Reset ALL",500,30);
// rect (640,12,20,20);
// text (mouseX,25,700); //display horizontal pixel position of cursor
// text (mouseY, 25,720); //display vertical pixel position of cursor
}
void ResetAll() {
p5c1=0;
p5c2=0;
p2c1=0;
p2c2=0;
p6c1 = 0;
p6c2 = 0;
ccs1c1 = 0;
ccs1c2 = 0;
ccs2c1 = 0;
ccs2c2 = 0;
ccs3c1 = 0;
ccs3c2 = 0;
p4c1 = 0;
p4c2 = 0;
rob1c1 = 0;
rob1c2 = 0;
rob2c2 = 0;
rob2c1 = 0;
rob3c1 = 0;
rob3c2 = 0;
riv3c1 = 0;
riv3c2 = 0;
riv4c1 = 0;
riv4c2 = 0;
riv6c1 = 0;
riv6c2 = 0;
weld4c1 = 0;
weld4c2 = 0;
weld5c1 = 0;
weld5c2 = 0;
sys58c1 = 0;
sys58c2 = 0;
broachc1 = 0;
broachc2 = 0;
headerc1 = 0;
headerc2 = 0;
}