Lucky Cat Tutoring Services


Making a Finch Count With ‘For’ Loop
October 6, 2009, 3:01 pm
Filed under: Finches, Java | Tags: , , , , ,

Here’s some code to make the CMU Finch count down from 10 and sing.

/**
 * Created by:
 * Date:
 * make baby Finch count and change nose color to a random tint with each number
 */

import finch.*;
import javax.swing.JOptionPane;
import java.util.Random;

public class finchCount
{

   public static void main(final String[] args)
   {
   // Instantiating the Finch object
      Finch baby = new Finch();
      Random spin = new Random();
      int count, redNum, greenNum, blueNum;
   String input; //name for what you’re asking for
  
   
  input = JOptionPane.showInputDialog(null, “What number do you want to count to?”);
  count = Integer.parseInt(input);
  
  for(int i = 1; i <= count; i++)//variable I; while I is lessthan/equal to COUNT, keep adding to I
          //never a ; here
  {
   baby.saySomething(“”+ i);
   baby.sleep(1000);
   //turn nose to random color
   redNum= spin.nextInt(256);//random num between 0 and 255
   greenNum= spin.nextInt(256);//random num between 0 and 255
   blueNum= spin.nextInt(256);//random num between 0 and 255
   baby.setLED(redNum,greenNum,blueNum);
   baby.sleep(1000);
   System.out.println(“number ” +i);
   
   
  }
      // Always end your program with finch.quit()
      baby.quit();
      System.exit(0);
    }
}

How about a fun nose  color change too? Continue reading



CMU and Finch Robot
August 20, 2009, 4:28 pm
Filed under: Class Notes, Finches | Tags: , , ,

Tom Laurs, the lead researcher for CMU’s robotics institute came to visit class this week. He develops learning robots for computer science education at the newbie level and we’re one of the lab rat groups. Frankly a little robot like that is more “Friendly” to learn with than say a mountain of code. Without sounding too girly, it makes programming seem not so hard or scary when you’re telling a robot to move vs being confronted with “Write a program to mimic photoshop” or some nonsense like that.

Finch robot has a beak that can be programmed to be in any color like the Mathmo Aduki. It can see shapes and lights and can thus follow a person if told to. It can sense temperature to a point and it can move around on the floor on its leash. The Finch can tell how it’s held (upside down, on its side, etc) using an accelerometer from the Wiimote. It can also “speak” through computer speakers.

As we work with the finches I’ll post more on this posting. It’s cute for a tiny robot on a USB cable. Here’s the website of one of the guys who’ programmed it and a pic of it.
Erik Pasternak’s Page

It's probably sleeping because the nose light isn't on, and of course not plugged in

It's probably sleeping because the nose light isn't on, and of course not plugged in