InteractiveBody Workshop_002_04=Arduino_MuscleWire

Page 1

ARDUINO

(Shape Memory Alloy)


What is SMA? Shape Memory Alloy Muscle Wire


A shape-memory alloy (SMA, smart metal, memory metal, memory alloy, muscle wire, smart alloy) is an alloy that "remembers" its original shape and that when deformed returns to its pre-deformed shape when heated.



Let your SMA MOVE?


Let’s do the wiring first


On/Off


start with 9V first


Where is the code?


Basically, the same code as: Ardiuno/Example/Basic/Blink /* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // give it a name: int led =

9;

Change it to 9, otherwise you will burn it

// the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)

Change the time longer delay(3000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW }

delay(3000);

// wait for a second


On/Off


Let’s add stuffs for the wiring


This is what we need to add


So we can more or less control the degrees of it


Upload the code: File > Examples > Servo> Knob. #include <Servo.h> Servo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created int inPin = 0; int pos = 0; // variable to store the servo position int newPos; //position for remap void setup() { myservo.attach( }

9 ); // attaches the servo on pin 9 to the servo object

void loop() { pos = analogRead(inPin); newPos = map(pos,0,1023,0,179); myservo.write(newPos); delay(15); }

Read the data from “A0� Remap the data from 0-180 Output data



Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.