Forum Replies Created
-
AuthorPosts
-
Michael
KeymasterOk, glad you have it working. I’m still not clear on why you couldn’t use a pin change interrupt on an input pin. If your goal is to sense the input voltage change caused by an external event, that’s what pin change interrupts can be used for. It’s not as straightforward from a code standpoint, but the library makes it easy.
Your right about vias — there’s nothing wrong with them at all, I just take it on as a challenge to design my boards without them. It’s just a routing challenge for me.
Michael
KeymasterThe Burrito 2.0 is unreal. That’s just incredible work.
You guys must be legendary in the Airsoft community!
Michael
KeymasterI think you are misinterpretting the meaning of the API functions [tt:2bo3kbzi]setDecimalPoint[/tt:2bo3kbzi] and [tt:2bo3kbzi]setDigit[/tt:2bo3kbzi] They are simply a way to directly control the LEDs directly without any interpretation by the library about how to display values. They are an alternative to using [tt:2bo3kbzi]setValue[/tt:2bo3kbzi]. So, [tt:2bo3kbzi]setDecimalPoint(2, true)[/tt:2bo3kbzi] does not mean “always display the decimal in position 2 when I display numbers”. It just means “turn on the decimal for digit 2”. It is not a “fixed point mode” for displaying values. Hope that makes sense.
You could implement a “fixed point mode” easily enough, I think.
int fixedPointModePosition = -1;
void setFixedPointMode(int position) {
DigitShield.setPrecision(position);
fixedPointModePosition = position;
}
void setFixedPointValue(int v) {
if (fixedPointModePosition < 0) {
// not in fixed point mode
DigitShield.setValue(v);
return;
} else {
DigitShield.setValue(v / fixedPointModePosition);
}
}
Or something like that. I wrote that really fast.
Michael
KeymasterIn fact, any Arduino pin can be used to sense external interrupts. It’s true that pins 2,3 are mapped to very fast external interrupts implemented by the ATmega328. But all other pins can also be used to trigger an interrupt routine when the pin state changes. These are called “pin change interrupts” versus “external interrupts”. The only difference is that they are triggered equally on rising and falling edges, so you need to check the state of the pin to determine which state change occurred.
In short, you can sense external voltage change events on any pin and dispatch immediately to an interrupt handler. See http://arduino.cc/playground/Code/Interrupts
A convenient library for dealing with pin change interrupts is here:
http://code.google.com/p/arduino-pinchangeint/The choice of using pins 2-5 for the Digit Shield was very intentional with the above tradeoffs in mind. The routing and layout of the board was very challenging (for me, at least), as I wanted to achieve a particular form factor for the shield. I really needed to use pins near the right side of the board so I could route the signals. As you can see by the board layout, this was a very tricky layout, but I still managed to do it without using any vias!
http://nootropicdesign.com/digitshield/design.htmlMichael
KeymasterYes, please see the TVout documentation:
Michael
KeymasterThe pollserial library includes println(). Instead of asking on a forum, why don’t you just try it or simply look at the pollserial library yourself?
Michael
KeymasterOk, thx for the update. These things happen to the best of us! I’ve made plenty of mistakes like that.
Michael
KeymasterThat sounds like a cool mod. I don’t know how to connect the loud smoke detector alarm, but perhaps you can figure it out. Just to be clear, the Defusable Clock runs on 5V, not 9V. The input is 9V, but the voltage regulator outputs 5V for the circuitry to run on.
If you can figure out how to activate the smoke detector alarm with a switch, then a relay could be used to turn it on. Some code changes required…
Michael
KeymasterIt could be a bad voltage regulator, but it is most likely a solder short from a pad to the ground plane. The bottom of the board is filled with a ground plane, and sometimes a bit of the black solder mask is burned away accidentally and the copper is exposed. If a solder joint accidentally connects with this ground plane, there is a short.
Make sure that none of your solder joints are accidentally going beyond the solder pad and connecting to the ground plane underneath the black solder mask. Look especially at the solder joints marked in the image below with red circles. Sometimes there is a bit of extra solder that can be removed. Also, if you can take a good, high quality photo of the front and back of the board and post it, I’m happy to have a close look.
Of course, if there’s no easy fix I am happy to send you a replacement. Where are you located?
Michael
KeymasterWhat are you trying to do? Write to the screen? Write data to the computer?
tv.print(c) writes to the screen.
pserial is for writing out the UART on the Arduino (e.g. to a computer).You need to stop and think about what you are trying to accomplish.
Michael
KeymasterYes, pollserial allows you to do serial communication, just like normal Arduino Serial. The TVout library comes with an example of using pollserial. It is called NTSCserialTerm.
Michael
KeymasterSorry it wasn’t resolved. I will send you a new kit. Please email support@nootropicdesign.com with your details. If you ordered from us directly, just remind me what your order number is, or name or whatever. Again, sorry about the difficulties.
Michael
KeymasterYes, you can connect multiple shields to one Arduino. See this article:
http://nootropicdesign.com/projectlab/2011/05/21/multiple-digit-shields/There are enough output pins on the Arduino to drive 4 shields, but you would want to use a large voltage regulator to provide power to the shields. The Arduino regulator would not handle the load well.
Michael
KeymasterThe analog comparator threshhold is controlled with the long-stemmed potentiometer on the board. The code for finding the bounding box of a spot is not in the library. It’s in the sketch for this project:
http://nootropicdesign.com/projectlab/2011/03/20/arduino-computer-vision/
It’s just a simple algorithm for finding the first row, last row, first column, and last column with white (or black if you invert) pixels. Study this code.
// compute bounding box
minX = W;
minY = H;
maxX = 0;
maxY = 0;
boolean found = 0;
for(int y=0;yfor(int x=0;x c = tv.get_pixel(x,y);
if (c == 1) {
found = true;
if (x < minX) {
minX = x;
}
if (x > maxX) {
maxX = x;
}
if (y < minY) {
minY = y;
}
if (y > maxY) {
maxY = y;
}
}
}
}
// draw bounding box
tv.fill(0);
if (found) {
tv.draw_line(minX, minY, maxX, minY, 1);
tv.draw_line(minX, minY, minX, maxY, 1);
tv.draw_line(maxX, minY, maxX, maxY, 1);
tv.draw_line(minX, maxY, maxX, maxY, 1);
sprintf(s, "%d, %d", ((maxX+minX)/2), ((maxY+minY)/2));
tv.print(0, 0, s);
}If you want to do something more sophisticated, like identify more than one spot, then you need to write more sophisticated code than this.
Michael
KeymasterYes, the Arduino’s voltage comparator is used to determine whether a pixel is black or white. The object tracking example is very simple and only looks for the bounding box around the area with dark (or light) pixels. To identify separate individual spots, you’ll have to write some more sophisticated code to process the frame buffer.
-
AuthorPosts