Example Projects
Workshops
Announcements
Actuators
Connections
Power
Sensors
Traces

Circuits and Code Wireless

Meet the Materials
Conductive Materials
Non-Conductive Materials
Tools
Techniques
Thinking Out Loud
Circuits and Code
  • Arduino Overview
  • Arduino as Bluetooth HID
  • ATtiny: 7-Segment Display
  • ATtiny: Capacitive Sensing
  • ATtiny: Programming
  • ATtiny Serial & Wireless Boards!
  • ATtiny: Soft Serial
  • ATtiny: Sound
  • ATtiny: Soft Fade
  • Bits and Bytes Binary numbers
  • Multiplexed Matrix
  • Controlling EL Panel and EL Wire
  • EL panel/wire inverter hack
  • EMF amplifier
  • Heat Controlling Circuit
  • LED with Light Sensor
  • Lilypad XBee Shield
  • My First Arduino Connection Check
  • pressure matrix code + circuit
  • Pull-up Resistors
  • Rabbit Control Client on Bela
  • RabbitControl on Bela
  • RGB Colour Fade
  • simple heat circuit
  • Solar Powered Motor Circuit
  • Sound Amplifying Circuits
  • Graphing and Drawing Sensor Values
  • Teensy as HID Device
  • Transistor Switch
  • Volume Detection
  • Visualization: 2x2 Matrix
  • Visualization: Drawing
  • Visualization: Graph
  • Visualization: Pressure Sensor Matrix
  • Visualization: Touchpad
  • Voltage Divider
  • Voltage Divider with Arduino
  • What is Variables?
  • Support the creation of content on this website through PATREON!
  • About
  • E-Textile Events
  • E-Textile Spaces
  • Newsletter
  • Print & Publications
  • E-Textile Shopping

  • SEARCH
    Content by Mika Satomi and Hannah Perner-Wilson
    E-Textile Tailor Shop by KOBAKANT
    The following institutions have funded our research and supported our work:

    Since 2020, Hannah is guest professor of the Spiel&&Objekt Master's program at the University of Performing Arts Ernst Busch in Berlin

    From 2013-2015 Mika was a guest professor at the eLab at Kunsthochschule Berlin-Weissensee

    From July - December 2013 Hannah was a researcher at the UdK's Design Research Lab

    From 2010-2012 Mika was a guest researcher in the Smart Textiles Design Lab at The Swedish School of Textiles

    From 2009 - 2011 Hannah was a graduate student in the MIT Media Lab's High-Low Tech research group led by Leah Buechley


    In 2009 Hannah and Mika were both research fellows at the Distance Lab


    Between 2003 - 2009 Hannah and Mika were both students at Interface Cultures
    We support the Open Source Hardware movement. All our own designs published on this website are released under the Free Cultural Works definition
    Circuits and Code

    What is Variables?

    When starting to learn programming, one of the concept that is hard to grasp (it was hard to grasp for me…) is “variables”.

    “In computer programming, a variable or scalar is a storage location (identified by a memory address) paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value.” (wikipedia)

    For example, when you open Arduino example sketches, you will see it at the very top, before the setup() function, a sentence like “int val = 0:” These are declaring variables. Or in the loop() function “int sensorVal = analogRead(A0);” in this case, it declares variables and immediately assigning value to it.

    Anyway, for long time, it was hard for me to grasp this concept, and here is how I picture what Variables are.

    You create a container box, and label it with a unique name. In this case, I give a name “val1″. This name can be anything.. but it is a good idea to give something meaningful so you can remember later what is what… It is same as you organizing your storage. If you give arbitrary name to your storage boxes, it will become difficult to know what is stored where… so it is a good idea to think of a naming system. Note that you can not use space ” ” in your labeling name. if you need to use space, often people uses “_” or capitalization of the second word to keep it readable.

    When you create a containers, you need to specify the size of the container. The size depends on how many bits you need in order to express the data you want to store in your variable container. For example, boolean is only 1 or 0, and you need only 1 bit. integer (int) uses 16 bit and can store numbers between -32768 to 32768, but it can not express point numbers (i.e. 2.6 or 8.432). If you need to store point numbers, you need float, which is 32bits.

    Here, I made 2 boolean variables, val1 and val2. The beans represents bits. standing = 1, laying = 0.

    boolean val1=0;
    boolean val2=1;
    val2 = val1;

    The above operation means that: first look into what is in val1 container (0) and put that data into val2 container. so after this operation, both val1 and val2 contain 0.

    another confusing one is an operation like this one:

    val1 = val1 + 1;

    In this case, you first look into what is in val1 container… which is “0”. Then add +1 to it (0 +1) then the result goes into what is on the left side of “=” that is val1. You can take the content from a variable container, calculate/operate and put it back to the same container. This is used very often and it seems confusing… but once you get the idea, it is actually very useful.

    For example:

    int counter = 0;
    loop(){
    counter = counter + 1;
    }

    This will make the counter count up every time loop() function runs… up to 32768. Then it will come back to 0 and counts up again.

    You can also make a shelf storage instead of individual boxes. It is called array. This becomes handy if you are storing related objects. For example, when you are storing different size screws, instead of storing them in individual boxes that is called “screw_3mm”, “screw_5mm”… you can also use a shelf for screws and keep various screws in each drawers. This will be much easier to organize. Array story will come in another time.



    Leave a comment