Updated Arduino sketch