attiny tilt switch pwm

Either the code is wrong or the wiring is wrong.

Test the motor wiring with this simple program. It waits 3 seconds, then turns the motor on and off twice. Take a similar divide and conquer approach for the other parts of the program.

const int outPin = 1;       // dc motor

void setup()
{

  pinMode(outPin, OUTPUT);
  digitalWrite(outPin,0);
  delay(3000);
  digitalWrite(outPin,1);
  delay(1000);
  digitalWrite(outPin,0);
  delay(1000);
  digitalWrite(outPin,1);
  delay(1000);
  digitalWrite(outPin,0);
}
 
void loop()
{}