Example Code for Arduino-Robot Eye

Last revision 2026/01/07

Vortex uses two 5x5 leds matrix as its eye, IIC interface.

Hardware Preparation

Software Preparation

Wiring Diagram

Other Preparation Work

  1. Unscrew the screw and open the USB programming port.
  2. Turn on Vortex power switch, and plug in the Micro usb cable, it will install the driver automatically if you have installed Arduino IDE. If not, you can find it in the driver file in Arduino IDE folder-->Drivers folder.
  3. There is a switch close to the USB port, make sure the trigger is close to the USB side. This is MP3 switch, we'll teach you how to add new song in the following chapter.
  4. Open your Arduino IDE, select "Arduino UNO" and right "COM port" in Arduino IDE, now you can enjoy coding.

Sample Code

/***************************************************
 Vortex V1.0 (Small robots like bread)
 <https://www.dfrobot.com.cn/goods-1199.html>
 ***************************************************
 This example show how to use Gray sensor on vortex.
 Created 2016-2-3
 By Andy zhou <[email protected]>
 version:V1.0
 ****************************************************/
/***********Notice and Trouble shooting***************
 1.Connection and Diagram can be found here
 <http://wiki.dfrobot.com.cn/index.php?title=(SKU:ROB0116)_Vortex%E5%8F%AF%E7%BC%96%E7%A8%8B%E6%9C%BA%E5%99%A8%E4%BA%BA#.E6.A0.B7.E4.BE.8B.E4.BB.A3.E7.A0.81>
 2.This code is tested on vortex V1.0.
 ****************************************************/
#include <Wire.h>
#define I2C_LED_ADDRESS 0b1100000
#define I2C_WRITE   0x00
uint8_t serial=0;
void setup(){
  Wire.begin(); // join i2c bus (address optional for master)
}
void loop(){
  Wire.beginTransmission(I2C_LED_ADDRESS << 1 | I2C_WRITE); // transmit to device #4
  Wire.write(0x01);
  Wire.write(serial);
  /*Wire.write(0x55);
  Wire.write(0xAA);
  Wire.write(0x07);         //color set
  //1  2  3  4  5      25 24 23 22 21
  //6  7  8  9  10     20 19 18 17 16
  //11 12 13 14 15     15 14 13 12 11
  //16 17 18 19 20     10 9  8  7  6
  //21 22 23 24 25     5  4  3  2  1
  Wire.write(0x07);
  Wire.write(0x18);
  Wire.write(0x00);
  Wire.write(0x04);
  Wire.write(0x00);
  Wire.write(0x07);
  Wire.write(0x18);
  Wire.write(0x00);
  Wire.write(0x04);
  Wire.write(0x00);
  Wire.endTransmission();    // stop transmitting
  serial++;
  if(serial==35) serial=0;
  delay(500);
}

Was this article helpful?

TOP