Troubleshooting Using Bias Voltage

ICP Sensors are nice!

The last two days I was frustrated with an ICP (Integrated CircuitPiezoelectric) vibration sensor not working.

There were glimpses of uptime but it was just that. Glimpses…

The sensor is driven by a dead simple circuit:

As you see:

  • A current limiting diode (surprisingly expensive)
  • A polarised capacitor (Tip: Use a tantalum capacitor for lower noise levels)
  • A 470K resistor

The circuit has worked before and even if it is difficult to mess, I checked more than 10 times the polarity and the continuity of the circuit.

As you can see in the picture, there is one thing there called DC Bias. Just keep it on your mind.

Brief (fun?) theory

As I mentioned we are using an ICP sensor. These sensors are powered with a constant current DC source. The power supply is typically 18–30 Volts DCcurrent limited via a constant current diode between 2 and 20 mA. Typical battery operated supplies offer 2 mA of constant current to extend battery life while continuous monitoring systems offer more current in order to drive longer cables.

The signal output of an ICP sensor is a low impedance voltage signal proportional to the dynamic measurement such as force, pressure, or vibration. This voltage signal is carried on a DC bias voltage. The AC dynamic signal is superimposed on the DC bias voltage and is allowed to swing between the supply voltage and ground. Unlike an Operational Amplifier (Op Amp) that requires a plus and minus supply and allows the signal to “ride” on ground and “swing” between the plus and minus “rails,” the ICP sensor requires the output signal to be DC biased.

Let’s get troubleshooting!

So, how do you check the sensor?

As you see I cannot break through it to see if I’ve fried it (these are pretty sturdy and frying them is harder than it sounds). I am also pretty sure that my circuit is good as it have worked perfectly before.

The DC Bias of the sensor can quickly and reliably show us if the sensor is working and if we have connected it correctly.

Below there is a table with common DC Bias voltages and their meaning:

Three scenarios are possible:

  1. Generally, if you get around half your supply voltage you are good to go.
  2. If you get 0 Volts you have probably shorten out something. Woops!
  3. In my case, I got my supply voltage which means the connection to the sensor is faulty resulting to an open circuit. Check your cable!

Conclusions

As you see the DC Bias on these sensors is very useful for troubleshooting. So next time you bump on a wall like that you know what to do!

The new MacBook is not there yet

I literally wrote the title at the start of the Apple Watch announcement at Apple’s “Spring Forward” event. It was “The new MacBook is awesome”.

Then I changed it.

I am not an Apple fanboy by any means. I bought my 13″ MacBook Air at the end of 2012 because it was the best computer for the money and my needs at the time of buy.

I’ve absolutely loved it.

It still performs really well and to me and my workflow, it is the much lighter, longer battery, less noisy Linux machine I had without the quirks and the annoying graphics card problems.

When I saw the new MacBook I was stunned. I wanted to have it.

I know it is not easy to live on one port… I will manage it… I will buy a bunch of1adapters and put them on my workspaces…

Who am I kidding…

I get pissed when I have to use a hub now that I have 2 USB ports. Imagine having a bunch around and chaining them. I cannot do CAD work on a trackpad even if it is the best. I’ve struggled with bluetooth mouses in the past so I don’t bother anymore. And I like the key travel on my current MacBook and even more on my mechanical keyboard. Why should I trade that for some butterfly?

OK. This I’ll manage. But the underpowered CPU I cannot manage. And this is the actual deal breaker for the majority. Not the ports.

Most of us who want a machine like that, we need the power. When Core M is the equivalent of an i5 I am sold. Until then, this is a very expensive netbook and people are better of with a Chromebook.

Not-yet-there-ness

All this is very familiar. Remember the MacBook Air in 2008?

If yes, you are older than 12 years old and you know that the new MacBook will replace it in a couple of years if not sooner.

Like with the Air, the MacBook has considerably less ports. The world moved on then, it will move on now.

As for Core M CPUs, cut them some slack. This is their first iteration.

In one or two iterations, this will be the most recommended computer like it or not.

Apple is forking.

Into the fashion industry.

They will keep delivering some awesome hardware for power users who don’t want to mess with the system but also they are getting into fashion deeper than ever before.

The new MacBook is a better showcase of that fork than anything that appeared on the event (looking at you Apple Watch). It is slick, it is hot and a fashion statement but it is not for anyone who does more than basic web browsing and email not only due to the single port but most importantly for the intentionally underpowered CPU.

So keep filling that piggy bank and someday we will get what many of us consider the best machine ever.

Working with people

The world nowadays works in teams and as you may know I’ ve been involved in many teams around this time.

This team can be a startup, a group, a hackerspace or even you and your friends.
When some people do something together they are a team. And a good team acts like a good piece of machinery.

Working in teams is hard but also very efficient.
If a team is managed correctly, many extraordinary things can be done.

This is what I’ve understood about being in teams and learning from my mistakes and others’.

Score the Goal fast

I am not a football fan by any means but it is pretty straightforward that your sole concern is to put the ball behind the line.

It doesn’t really matter if you do it from the centre of the stadium with the most cinematic way or you do it with a simple boring move.

Either way you get one point.

Don’t over-thing about the best way to do something. It results almost always to a lot of talking and less doing.

Just do it!

Temporary does not exist

Give final solutions. Not placeholders.

When you need to make a choice, never reschedule it with a wrong response. You will forget about it and learn to live with it.

So make every decision count by choosing the best solution at the time. You can always fine-tune later.

Stay motivated

Being in a team can be exhausting but when you accomplish stuff, this does not matter.

However it is very common to get stuck. Your hands are tied and you can’t move.
When in this position don’t panic but do something to get cracking.

For as long you stay frozen, your team develops tension and if it reaches critical tension points often or stays on them for a long time, it might break.

When machines are static they rust and break.

As Pascal Finette says, Always run. Never walk.

Be precise and push when needed

You have to be clear and precise to others. Give them all the info that is needed and also demand it.

Also when the job at hand must finish, don’t wait for the others. Do the most you can and push them to do their part.

Log everything

There should be a log of the team and things should not rely on memory.

Write down what happens when it happens and when the time comes you will be glad you did.

But be bold but straight

You cannot afford to keep things inside. Listen to people and they will listen to you.

When you find that you don’t agree with something, tell it to the other’s face with care, not with grudge.

One can get defensive or better. If you do it the right way and everyone keeps an open mind, most of the times you will hit the second case.

Value human relations

Many times we tend to forget that our teammates most of the times are also friends.

More often we forget about friends and people outside of the team. They are the ones who support you and you are the one who supports them.

Remember to have time for everyone. Most of all remember to have time for new connections.

That’s the only way you will meet more and more amazing people.

Be positive

Hard times will come but also happy ones that make up for everything.

Solve your problems quickly and don’t blame others.

The thing you do best is to solve problems.
Put it in use for the things you can do something and don’t bother with things you can’ t do something about.

Hope I was of help. You can speak your mind in the comments! :)

My edX Wishlist

Due to a violent occupation of the ECE Department of the University of Patras from students that has led to the semester’s loss, me and my friends are gonna end up with some extra free time.
We may study the next subjects by our selves or we can have some top notch professors and universities to teach us.

Here is my (long and very unreal) edX whishlist:

Robot Mechanics and Control, Part I

I am actually doing this one now. It is very comprehensive and teaches the basics of kinematic chains and degrees of freedom. It is pretty fundamental stuff explained in the best way possible.

Electronic Interfaces: Bridging the Physical and Digital Worlds

Basic circuits and micro controller introduction. As internet of things and wearables are considered the great thing for the next couple of years this is a must to grasp the basics

Innovation and Commercialization

How innovative products are made. Not a must but it is interesting.

Economics of Cybersecurity

With 2 major breaches in the last six months cyber security is a hot topic alright. Impacts on the economy are starting to show, so if you care about that stuff this seems good.

Mastering Quantum Mechanics

Always wanted to be able to say the above. A dream coming true!

Signals and Systems, Part 2 

No introductions here. You can skip part one if you’re already familiar with the basics.

Circuits and Electronics

Refresh your circuits skills and knowledge. Basic stuff again.

Introduction to Aeronautical Engineering

Aeronautical Engineering was my second choice but I find it very interesting.

Introduction to Solid State Chemistry

Great innovations happen in that sector. As graphene enters our lives a we should refresh organic chemistry at least.

Underactuated Robotics

Walking and swimming robots. Nothing to say here.

Introduction to Computational Thinking and Data Science

Learn to break problems to smaller problems. This is the first step to problem-solving, for this is actually what we do.

The Science of Happiness

Don’t worry be happy!

Εntrepreneurship 101: Who is your customer?

One of the main entrepreneurial problems.

Building Mobile Experiences

Mobile is everywhere now and as a result implementations of mobile experiences interest us.

Discrete-Time Signal Processing

Aka. DSP.

This list is a completely personal collection choices resulting from a 5 minutes scrolling research. You can surely find something that interest you out there.

Other sites that provide courses are:

Hope I helped.

Get a Password Manager Now

There is a new breach boy in town and this time is called ShellShock.

Researchers claim that it is a lot worst than Heardbleed.

It is a Bash bug that allows almost anyone to execute commands to a remote machine.

For more about that here.

When these bugs get exposed, fear push us to security.
And as Batman says, fear is a tool!

Since then, 1Password’s sales skyrocketed!
Same thing with other passwords managers for sure. And why is that?

We mostly use one or two password everywhere, they are probably in the dictionary and our safeguard is that digit or character we change each time.
Sounds familiar?

It is known that passwords are a bad authentication method.
There are so many weird things going on when you want to be safe with them…

You have to remember a very long string of case sensitive jiberish with symbols and numbers.
Multiply that by all your accounts and you get 100+ such strings to remember. The guy from Rainman would have gotten dizzy.

This is where password managers come in.

These are tools that help you automate and secure your password problem.
They offer browser extensions to fill in passwords for you, integrate password generators and monitor when you change your passwords so you don’t forget to update your database.
Your passwords are stored in a database that stays encrypted and decrypts when needed.

Whichever manager you choose, it must have a mobile app.
We use our phones to do serious stuff so this part should not be underestimated.

The most famous are LastPass, 1Password & Dashlane as far as I know.

LastPass

One of the oldest. It is the LastPass that you have to remember and it works pretty well.
it is not the most well designed but it offers Linux and even Symbian support and that makes it the most versatile.
It is free for desktop use but if you want the sync features you have to pay $12 a year which is very cheap ($1/month).
On Android the app is a fork of the Firefox for Android browser and it works OK to dig up a password.
Note that your passwords are stored on LastPass servers (AES-256 encrypted though).

What makes it special: A pop up comes up when you want to login in an app that you have a web account registered in LastPass.

1Password

The only solution that offers control over where your data is stored Dropbox or simply locally.
It uses AES-256 encryption with a strong autogenerated key that is unlicked by your Master Password.
You can sync between your computer and mobile via Dropbox or via WiFi.
There is only Windows and Mac support on the Desktop and only iOS and Android on mobile.
The applications are very well designed but they don’t offer autologin on apps beyond their included browsers on mobile.
It has a free trial but after that it costs $50 for a one time licence.

What makes it special: The ease of use and the ability to control where you store your passwords.

Dashlane

It is my personal favorite but I am cheap and I use LastPass. It keeps your data encrypted (Yes, that uses AES-256 too) on Dashlane’s servers.
The interfaces are better than LastPass so you are going to use it more and it offers the ability to store Credit Cards and a very good form completion feature. It costs $40 a year which is not cheap.

What makes it special: It has very good apps and it also offers an Android Keyboard to use to input your passwords on mobile. It is safe to believe that this is coming to iOS too.

Google

Google is more aggressively implementing password manager features in Google Chrome. It keeps passwords encrypted proposes randomly generated passwords and to save passwords but is not yet as advanced as the others.

Keeping all your really strong passwords in one place encrypted is better than using the same password everywhere.

Start using a password manager today.

An easy Media Server and Time Machine

I hate mess… So I like remote solutions!

One thing that bothers me is the USB cable that I always have connected on my computer.
On it’s other end, lies a 1TB Hard Drive that stores my Time Machine backup.

From time to time I stream movies via Plex from the same hard disk.
That’s because I don’t want to store movies on my low capacity Macbook Air.

Since I got my Chromecast, Plex has gone to the top of my “Useful Software” list as it supports Chromecast and I can stream the Movies without connecting a HDMI cable.

So what I need? A HDD in my network that hosts my media and my backups.

Nice, but not so cheap.

Using a spare very low powered netbook and the Time Machine HDD, I managed to put away these 2 functions from my laptop.

I could also get torrents directly on my netbook. Life would be easier…

Let’s do it!

Preparation

What we will need

  • We need something debian-based. Preferably use your old computer or netbook but not your Rasperry Pi as Plex does not support it officialy yet (I think). You can check your chances with RasPlex if you feel like it.
    • I used Ubuntu Server 14.04 LTS 32bit on an old Lenovo ideapad.
  • A large enough Hard Drive. TB has gone pretty cheap lately.
  • An afternoon.

Format the Hard Drive

Put the HDD on OS X and create a big partition for the Time Machine using Disk Utility.

Leave the rest Unallocated.

Remeber not to have spaces on the disk labels. I used timemachineand diskspace

Next holding option click partition from the sidebar and Disable Journaling.
We do this to ensure compatibility on case of restore.

Then on linux format the rest as ext2ext3 or ext4.

You can use parted for that.

Setup system

Use blkid to check your Partiotions UUIDs and note them.
The sdb ones are the ones we care about.

sudo blkid
/dev/sda1: UUID="dadbbcb0-0680-4633-b6a5-ebea09359478" TYPE="ext2"
/dev/sda5: UUID="PnN6eH-eipf-Rq1w-ddfi-FCf3-w23k-5NDAcE" TYPE="LVM2_member"
/dev/mapper/ideapad--vg-root: UUID="ab0966d5-eba5-4ca2-aeca-62234b4ce71f" TYPE="ext4"
/dev/mapper/ideapad--vg-swap_1: UUID="54745ca7-cb41-432f-aa3e-92ec708248e6" TYPE="swap"
/dev/sdb1: UUID="e14664bf-85bb-4265-99e3-787e454da730" TYPE="ext2"
/dev/sdb3: UUID="744f07e4-2075-34f5-811f-df6b37e2d2a7" LABEL="timemachine" TYPE="hfsplus"

Now create the mount points and give them the right permissions.

sudo mkdir /media/timemachine /media/tm_backup
sudo mkdir /media/diskspace /media/diskspace/transmission /media/diskspace/completed
sudo mkdir /media/diskspace/incomplete /media/diskspace/torrents
sudo chown -R tsagi:tsagi /media/diskspace/
sudo chown -R tsagi:tsagi /media/timemachine/

Add the settings to the end /etc/fstab so they mount on startup.

UUID=e14664bf-85bb-4265-99e3-787e454da730 /media/diskspace ext2 defaults 0 0
UUID=744f07e4-2075-34f5-811f-df6b37e2d2a7 /media/timemachine hfsplus force,rw 0 0

Then reboot.

Time Machine

Linux Server

First install Netatalk:

sudo apt-get install netatalk

Edit /etc/netatalk/afpd.conf with your favorite editor and add the following line at the end (comment out every other line that might be active):

- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2_passwd.so -nosavepassword

This will define the afpd server (Netatalk).

Next make sure your /etc/default/netatalk file shows CNID_METAD_RUN=yes.
This will ensure that all the metadata that is needed by OS X is handled and saved by an extra daemon on the side, too.

Now add the following to /etc/netatalk/AppleVolumes.default:

/media/timemachine/tm_backup "Time Machine" allow:username cnidscheme:dbd volsizelimit:650000 options:usedots,upriv,tm

Adjust the location of the directory and the username to your needs. The example above also limits the size shown to OS X as 650 GB (the number is given in MiB, so it’s 650.000 times 1024 in the real world). Also note that the tm option is only option separating a Time Machine capable directory from a regular afp share.

You should also edit the :DEFAULT property on/etc/netatalk/AppleVolumes.default file to match this:

:DEFAULT: cnidscheme:dbd options:upriv,usedots

Restart the Netatalk daemon to make sure it uses the newly adjusted configurations:

sudo service netatalk restart

We are now done configuring the server.

OS X Client

Open up Finder and press Command + K to bring up the “Connect to Server” dialog.

Connect to server dialog

Enter afp://ip_address_of_your_server, press Enter and select the according share from the list.
Fill in username and password from the user on the server (not the one on the Mac) and see if you have access to the share.
If everything works well, continue with the Time Machine preferences.

In the system preferences on your Mac, select Time Machine and click on “Select Disk…”

Select your share from the list, edit the other options like excluded directories and automatic backups to your liking and enjoy this cheap and reliable Time Machine solution!
The first backup might take quite some time, depending on your network and hard drive speed. All the following backups will be incremental and a lot faster.

Bonus: you don’t even have to manually connect to the server share before a backup. Time Machine will let its magic happen and auto-mount / un-mount the share whenever it is needed. Peace of mind in a box.

Credits: I used this guide with some changes I made.

Useful links:

afpd.conf manpage

AppleVolumes.default manpage

Media Server

What it takes to make the perfect media server for me?

Just a good torrent client and Plex!

Let’s get to it!

Torrents

For the torrent client I just used Transmission. It is more than good and it has a clean remote UI.

First get Transmission:

sudo add-apt-repository ppa:transmissionbt/ppa
sudo apt-get update
sudo apt-get install transmission-cli transmission-common transmission-daemon

We should add our user to the debian-transmission group.

sudo usermod -a -G debian-transmission user

Remember the directories we created earlier?
Let’s give the correct permissions.

sudo chmod -R 775 /media/diskspace/transmission

Now stop the daemon to configure transmission.

sudo service transmission-daemon stop

Backup the default settings:

cd /etc/transmission-daemon
sudo cp -a settings.json settings.json.default

Then create a transmission settings directory in your home folder (example:/home/user/.config/transmission-daemon), copy settings.json into it, and change its permissions to make it accessible to transmission-daemon:

mkdir /home/user/.config/transmission-daemon
sudo cp -a /etc/transmission-daemon/settings.json transmission-daemon/
sudo chgrp -R debian-transmission /home/user/.config/transmission-daemon
sudo chmod -R 770 /home/user/.config/transmission-daemon

Then, remove /etc/transmission-daemon/settings.json, create a symbolic link in the /etc/transmission-daemon folder, and edit it permissions to make it accessible to Transmission and the user account:

cd /etc/transmission-daemon
sudo rm settings.json
sudo ln -s /home/user/.config/transmission-daemon/settings.json settings.json
sudo chgrp -R debian-transmission /etc/transmission-daemon/settings.json
sudo chmod -R 770 /etc/transmission-daemon/settings.json

You can now start editing /home/user/.config/transmission-daemon/settings.jsonwithout worries of losing your settings.

You can copy mine but remember to change your settings and password if they don’t agree:

{
    "alt-speed-down": 500,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 1,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": false,
    "blocklist-updates-enabled": true,
    "blocklist-url": "http://www.example.com/blocklist",
    "cache-size-mb": 4,
    "dht-enabled": true,
    "download-dir": "/media/diskspace/transmission/completed",
    "download-limit": 100,
    "download-limit-enabled": 0,
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 2,
    "filter-mode": "show-all",
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/media/diskspace/transmission/incomplete",
    "incomplete-dir-enabled": true,
    "inhibit-desktop-hibernation": false,
    "lazy-bitfield-enabled": true,
    "lpd-enabled": false,
    "main-window-height": 500,
    "main-window-is-maximized": 0,
    "main-window-layout-order": "menu,toolbar,filter,list,statusbar",
    "main-window-width": 467,
    "main-window-x": 50,
    "main-window-y": 50,
    "max-peers-global": 200,
    "message-level": 2,
    "minimal-view": false,
    "open-dialog-dir": "/media/diskspace",
    "open-file-limit": 32,
    "peer-congestion-algorithm": "",
    "peer-id-ttl-hours": 6,
    "peer-limit-global": 240,
    "peer-limit-per-torrent": 60,
    "peer-port": 9071,
    "peer-port-random-high": 9098,
    "peer-port-random-low": 9026,
    "peer-port-random-on-start": true,
    "peer-socket-tos": "default",
    "pex-enabled": true,
    "play-download-complete-sound": true,
    "port-forwarding-enabled": false,
    "preallocation": 1,
    "prefetch-enabled": 1,
    "prompt-before-exit": true,
    "proxy": "",
    "proxy-auth-enabled": false,
    "proxy-auth-password": "",
    "proxy-auth-username": "",
    "proxy-enabled": false,
    "proxy-port": 80,
    "proxy-type": 0,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 1.5000,
    "ratio-limit-enabled": true,
    "rename-partial-files": true,
    "rpc-authentication-required": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-password": "{c371b29b1eb8a1164023ef4a13013e7583d8a736E5n9jnT/",
    "rpc-port": 9025,
    "rpc-url": "/transmission/",
    "rpc-username": "tsagi",
    "rpc-whitelist": "127.0.0.1,*.*.*.*",
    "rpc-whitelist-enabled": true,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "show-backup-trackers": false,
    "show-desktop-notification": true,
    "show-extra-peer-details": false,
    "show-filterbar": true,
    "show-notification-area-icon": false,
    "show-options-window": true,
    "show-statusbar": true,
    "show-toolbar": true,
    "show-tracker-scrapes": false,
    "sort-mode": "sort-by-name",
    "sort-reversed": false,
    "speed-limit-down": 0,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 1,
    "speed-limit-up-enabled": true,
    "start-added-torrents": true,
    "statusbar-stats": "total-ratio",
    "trash-original-torrent-files": false,
    "umask": 2,
    "upload-limit": 100,
    "upload-limit-enabled": 0,
    "upload-slots-per-torrent": 4,
    "user-has-given-informed-consent": true,
    "utp-enabled": true,
    "watch-dir": "/media/diskspace/transmission/torrents",
    "watch-dir-enabled": true
}

Now start the daemon and test the setup heading tohttp://your.server.ip.adress:9025/

sudo service transmission-daemon start

Plex

Finaly we need to set up Plex.

Go to Plex website and copy the link for the appropriate version for your setup. I got the 32bit Ubuntu version.

Download it and install it.

wget http://downloads.plexapp.com/plex-media-server/0.9.9.12.504-3e7f93c/plexmediaserver_0.9.9.12.504-3e7f93c_i386.deb
sudo dpkg -i plexmediaserver_0.9.9.12.504-3e7f93c_i386.deb

Next give plex the permissions it needs:

sudo gpasswd -a plex tsagi

Go to http://your.server.ip.adress:32400/manage and point your libraries to the transmission’s completed directory. It can figure out if you have a series episode or a movie in the directory.

Liked it? Every week I send an email. It involves:

  • Interesting things from the internet world.
  • Discussions on pressing matters.
  • Some personal additions.
  • Many surprises!

Join now and enjoy every Friday in your inbox! Sign Up here!

Spark Core, First thoughts

I just got my hands on my long waited Spark Core!

It is a tiny Arduino board with a built in WiFi module. Besides that and the obvious possibilities of the Core, there is an API making it possible for the Core to talk to the internet.

Let’s say I want to check the status of the Hackerspace of Patras (0 or 1).

This simple bash script that runs on my computer does just that:

#!/bin/bash

while true; do
  sleep 5
  st=$(curl -s http://www.p-space.gr/status/)
  echo "$st"
  if(( "$st" == "0")); then
    echo "P-Space is closed!"
  else
    echo "P-Space is open"
  fi

curl  https://api.spark.io/v1/devices/DEVICE_ID_GOES_HERE/status         -d access_token=ACCESS_TOKEN_GOES_HERE -d args="$st"done

What it does is to check the status and send it to the core with a request.The most important line is the curl command. That makes the request to the core.

Let’s put some code on our Core too!

int status(String args) {
  int status;
  if(args == "1"){
    status=1;
    digitalWrite(D7,HIGH);
    digitalWrite(D6,LOW);
  }
  else{
    status=0;
    digitalWrite(D6,HIGH);
    digitalWrite(D7,LOW);
    }

  return status;
}

void setup() {
  pinMode(D7,OUTPUT);
  pinMode(D6,OUTPUT);
  Spark.function("status", status);
}

void loop() {

}

This one sets pins D6D7 as outputs and makes the function status available to the cloud!

See it in action:

That makes everything easier! No need to start an HTTP server on the arduino (you could if you wanted).

It looks amazing for a device so small! Don’t you think?