8. Electronics production

This week we used Roland (mini-CNC) to mil electronic boards, for further soldering, programming and coding.


Documentation



Board cut




2 2 2


2 2 2


2 2 2 2 2


2 2 2 2


2 2


Try soldering




2


2 2


2


2 2


2


2 2


2 2 2 2


2 2 2 2 2


2 2 2


2 2 2 2


2 2


2 2


2


Programming


2 2


2 2


2 2


Code



          
#define PIN_LED_W 4
#define PIN_LED_Y 2
#define ON_BUTTON 14
#define MODE_BUTTON 15

boolean onbuttonWasUp = true;
boolean modebuttonWasUp = true;
boolean ledEnabled = false;
boolean onoff ;
int mode;

void setup() 
{
  Serial.begin(9600);
  pinMode(4, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(15, INPUT_PULLUP);
  pinMode(14, INPUT_PULLUP);
}

void loop() 
{
 
    boolean onbuttonIsUp = digitalRead(14);             // find out if the button is currently released

    if (onbuttonWasUp && !onbuttonIsUp);                // if the button was released and not released now
    {
      delay(10);                                        // exclude the bounce of the contacts of the clock button
      onbuttonIsUp = digitalRead(14);                   // and read the signal from the button again

      if (!onbuttonIsUp) 
      { // if the button is pressed, then flip the LED signal
          ledEnabled = !ledEnabled;
          onoff = !ledEnabled;
          digitalWrite(4, ledEnabled);
          digitalWrite(2, ledEnabled);
      }
    }

    onbuttonWasUp = onbuttonIsUp;                       // store button state for new iteration
    delay(200);

    boolean modebuttonIsUp = digitalRead(15);           // find out if the button is currently released
   
        if (modebuttonWasUp && !modebuttonIsUp);        // if the button was released and not released now
        {  
          delay(10);                                    // exclude the bounce of the contacts of the clock button
          modebuttonIsUp = digitalRead(15);             // and read the signal from the button again

          if (!modebuttonIsUp && onoff == false)                
          {                      
              mode = mode + 1;                          // counter of running position is incremented by 1
                              
              if (mode == 4)
              {mode = 0;}                               // if the counter limit is reached then reset
            
              switch (mode)                              //selection operator, executes its block depending on the value of the variable

              {
              case 0:
              digitalWrite(2,ledEnabled);
              digitalWrite(4,ledEnabled);
                return;
          
              case 1:
              digitalWrite(2,ledEnabled);
              digitalWrite(4,LOW);
                return;

              case 2:
              digitalWrite(2,LOW);
              digitalWrite(4,ledEnabled);
                return;
              }    
          }            
        }

}
        

Video



Video