Coding for wires

Coding for wires

Postby CKS » Wed May 30, 2012 8:29 pm

So i have bought the clock, and while i'm waiting for it to get here i thought i would ask some questions, but they might be a little dumb, mostly because this is all very new to me

1. Is it possible to connect this with outside broads?

2. what code would I change to make the wires not random

3. is it possible to make it so you have to cut the wires in a specific order or it will go off i.e. green, red ,blue ,and yellow.

Cheers CKS
CKS
Newbie
Newbie
 
Posts: 5
Joined: Wed May 30, 2012 8:22 pm

Re: Coding for wires

Postby Michael » Fri Jun 01, 2012 7:31 am

Not sure I understand what you mean by connecting to outside boards. What do you want to do?

Study the source code available on the Hack page: http://nootropicdesign.com/defusableclock/hack.html
The code for assigning the wires is in the function countdown(). Just change this code if you want it nonrandom.


Code: Select all
  // assign random pins
  defusePin = random(WIRE_1, (WIRE_4+1));
  detPin = defusePin;
  while (detPin == defusePin) {
    detPin = random(WIRE_1, (WIRE_4+1));
  }



To require a particular sequence, you'd have to be more clever, but the work is in the function countdown(). With some coding skill, you can do it.
Michael
Administrator
Administrator
 
Posts: 463
Joined: Sat May 29, 2010 8:24 am

Re: Coding for wires

Postby CKS » Fri Jun 01, 2012 11:07 am

did some research and what i mean to say is there control pins that i can connect to, to driver some servos or motors, or is there a way to connect more pins to the broad?
CKS
Newbie
Newbie
 
Posts: 5
Joined: Wed May 30, 2012 8:22 pm

Re: Coding for wires

Postby Michael » Fri Jun 01, 2012 12:07 pm

No, but you can use one of the LED connections if you want. That's one way to connect to something external.

I didn't want to make it too easy to control external devices in case someone wanted to make something actually dangerous.
Michael
Administrator
Administrator
 
Posts: 463
Joined: Sat May 29, 2010 8:24 am

Re: Coding for wires

Postby greenbean » Thu Dec 06, 2012 3:12 pm

ok so I have a noob question about this . what words in the coding do I change or remove, and to what, in order to make it not random. this is my first time trying to change code, so please be kind.
greenbean
Newbie
Newbie
 
Posts: 2
Joined: Thu Dec 06, 2012 2:59 pm

Re: Coding for wires

Postby Michael » Fri Dec 07, 2012 8:54 am

Just change the code in the countdown() function to assign the defuse pin and det pin to fixed values.

Code: Select all
defusePin = WIRE_1;
detPin = WIRE_3;



Remove the random assignment:
Code: Select all
defusePin = random(WIRE_1, (WIRE_4+1));
detPin = defusePin;
while (detPin == defusePin) {
  detPin = random(WIRE_1, (WIRE_4+1));
}
Michael
Administrator
Administrator
 
Posts: 463
Joined: Sat May 29, 2010 8:24 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest