Forum >Replies by pratyadi
userhead pratyadi
Replies (10)
  • You Reply: Hi All,

    After a long experiments I finally found a way to drive a PWM servo without relying on any PWM pin. This tutorial will show you how to position the servo angle by writting your own PWM function on Arduino IDE sketch:

    [url=http://www.linuxcircle.com/?p=640]http://www.linuxcircle.com/?p=640[/url]

    Briliant!  ;D
  • You Reply: So what do I do?

    They cant work together?  :o
  • You Reply: I think it is the 'famous' servo  vs PWM conflict problem, because I use A1 to attached a pan servo, and it uses the same timer with Pin 9 & 10 .

    As we know typical Leonardo board uses only 3 timers. And Servo uses the samep timer as Pin 9 and 10 and remove their PWM capability.  :P

    When I unassigned the servo from the analog pin, pin 9 & 10 work as normal.

    Can you confirm that this is the case with Romeo V2?
  • You Reply: Pin 9 and 10 works like charm when using DigitalRead or DigitalWrite, but not AnalogRead nor AnalogWrite where is should treat it as PWM.

    There must be somewhere in Arduino IDE c code that defines a pin as PWM or not.

    Can you investigate and test it your self?
  • You Reply: Hi Lauren,

    It's a privillage to share. Please provide links to www.linuxcircle.com in your product page too, as I update it regularly.

    I love your products, and I experiment with many of your kits.
  • You Reply: Thank you for the code, but as expected it doesnt work with DFRobot Romeo.

    Question is where do you specify the pins to be RX and TX? Is it always 0 and 1 by default?

    Problem is then, maybe not because of URM37, but because DFRobot Romeo does not provide instruction on activating the serial pins RX and TX.

    Can you help?
  • You Reply: Very easy

    The guys at www.linuxcircle.com wrote a really great tutorials on DFRobot Romeo V2 and Arduino codes that work so well with it.

    Check them out!
  • You Reply: I really cant figure out whats wrong with this. This script dont work with my Romeo

    /*
    DistanceBySoftwareSerial.pde - URM 37 Control Library Version 2.0.0
    Author: Miles Burton, [email protected]
    Copyright (c) 2009 Miles Burton All Rights Reserved

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or dfrobot FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    */

    // # This library is a improvement version of URM 37 Control Library Version 2.0.0 from Miles Burton
    // # Original Author: Miles Burton, [email protected]
    // #
    // # Editor    : Lauren from DFRobot
    // # Date      : 08.05.2012

    // # Product name: URM V3.2 ultrasonic sensor TTL connection with Arduino
    // # Product SKU : SEN0001
    // # Version    : 1.0
    // # Update the library to make it compatible with the Arduino IDE 1.0 or the latest version

    // # Description:
    // # The sketch for using the URM37 from DFRobot based on the Software Serial library
    // # You could drive the URM37 with 2 digital pins on your Arduino board, and it works stable.

    // # Connection:
    // #      VCC (Arduino)  -> Pin 1 VCC (URM37 V3.2)
    // #      GND (Arduino)  -> Pin 2 GND (URM37 V3.2)
    // #      Pin 6 (Arduino) -> Pin 9 TXD (URM37 V3.2)
    // #      Pin 7 (Arduino) -> Pin 8 RXD (URM37 V3.2)
    // #

    #include "URMSerial.h"

    // The measurement we're taking
    #define DISTANCE 1
    #define TEMPERATURE 2
    #define ERROR 3
    #define NOTREADY 4
    #define TIMEOUT 5

    URMSerial urm;

    void setup() {

      Serial.begin(9600);                  // Sets the baud rate to 9600
      urm.begin(6,7,9600);                // RX Pin, TX Pin, Baud Rate
      Serial.println("URM37 Library by Miles Burton");  // Shameless plug
     
    }

    void loop()
    {
      Serial.print("Measurement: ");
      Serial.println(getMeasurement());  // Output measurement
      delay(50);
    }


    int value; // This value will be populated
    int getMeasurement()
    {
      // Request a distance reading from the URM37
      switch(urm.requestMeasurementOrTimeout(DISTANCE, value)) // Find out the type of request
      {
      case DISTANCE: // Double check the reading we recieve is of DISTANCE type
        //    Serial.println(value); // Fetch the distance in centimeters from the URM37
        return value;
        break;
      case TEMPERATURE:
        return value;
        break;
      case ERROR:
        Serial.println("Error");
        break;
      case NOTREADY:
        Serial.println("Not Ready");
        break;
      case TIMEOUT:
        Serial.println("Timeout");
        break;
      }

      return -1;
    }
  • You Reply: Thanks Ricky,

    I solved the problem by:
    1. Use Arduino IDE v1.4 fresh install on another PC.
    2. Force specify the port on preferences.txt
    3. Pressed the reset button when uploading.

    It works. The problem was caused because of full memory usage, because I tried to upload the Super Mario Bross songs as listed on [url=http://www.linuxcircle.com]www.linuxcircle.com[/url]. Now it works perfectly because I use combination of standard array and PROGMEM, which stores the notes in another chip.
  • You Reply: Romeo v2 USB port stop working.
    Is there a way to fix this?

    I've had this for almost 2 months, but tonight, when I tried to upload Arduino sketch it stopped working. The board simply cannot take the codes, and the serial port /dev/ttyACM0 simply not recognised by 3 different computers.

    Is there a way to reset it to factory default? Or maybe is there a chip that got burnt and can be replaced?

    Please help me! I need the robot urgently