If you’re getting a NullPointerException stacktrace like the one below while using the Netbeans Visual Library to create your own GraphScene, check that your adding your widgets propertly to scene. A good idea is to use LayerWidgets, declaring them in the constructor of your GraphScene:
1234
1 2 3 4
<span class='line'>mainLayer = new LayerWidget(this);
</span><span class='line'>addChild(mainLayer);
</span><span class='line'>connectionLayer = new LayerWidget(this);
</span><span class='line'>addChild(connectionLayer);</span>
and then add the widgets to those layers in attachNodeWidget and attachEdgeWidget:
To be able to do Navigate ⇒ Go to Source on netbeans classes like TopComponent you need to link the sources to the Netbeans Plaform using the Netbeans Plaform Manager as explained in Hyperlinking to NetBeans API Sources.
Be sure to download the proper source zip from the netbeans download page, otherwise the Platform Manager won’t let you attach the source file to the platform (all invalid options are greyed out/dimmed):
After learning about the Favorites window in the NetBeans Platform Quick Start. I wanted to use it in an application of my own.
This easy task became more difficult that I though because I was getting random results, sometimes after a clean build I got the Favorites window open and sometimes not.
But let’s start from the beginning, I put my hands at work, it was just a matter of adding the Favorites module to the Netbeans Platform Application (app’s properties ⇒ Libraries ⇒ Platform Modules ⇒ platform9 ⇒ Favorites) and edit one of my modules layer.xml to override Windows2/Modes/explorer/favorites.wstcref. Just go to Important Files ⇒ XML Layer ⇒ this layer in context ⇒ Windows2 ⇒ Modes ⇒ explore ⇒ favorites.wstcref and replace
But it didn’t work as expected sometimes after doing a clean & build the favorites didn’t open at startup. So I asked in the forums and I got a tip that help me to resolve the issue. It was a module loading order problem. But how do you set the module loading order, easy, just click on your module properties ⇒ Libraries ⇒ Add Dependency ⇒ Non-API module ⇒ Favorites.
Adding a dependency with the Favorites modules will ensure that Favorites is loaded before your module and thus ensuring that you layer.xml changes will override the values set by Favorites module (and not the other way around).
I got the MAX756 that I was waiting for from Futurlec. The idea was to implement the very same circuit that comes in the MAX756 datasheet. In my first try I got very strange results which I posted to ladyada forum hoping to get some advice on how to solve. Eventually I set up the circuit in another breadboard and got it working the way I expected or at least I thought so.
Now I have the SMPS laid out on a breadboard. I’m powering this SMPS based on MAX756 with a 1.5V battery and I get 3.3V output with no load. If I connect a load (1led+220ohm) I still got 3.3V. That’s ok. I even connected three leds in parallel (24mA). Still working, I get a sound 3.3V reading in my DMM.
But when I connect this 3.3V output to my arduino project (mounted on a breadboard too) things change, and they change in a bad way. It seems to work perfectly for 5 or 6 seconds, 3.3V the green led mounted in the Arduino Pro Mini blinks as it should (because the sketch loaded does that) and the power red led in on and shining bright. But after 5 seconds the voltage drops from 3.3V to 1.7V, the red led still on but dimmed and the green led goes off. This lasts 1 sec maybe 2, and then the voltage goes up to 3.3V again. the arduino resets and the whole process begins again.
I don’t know what happening, but I decided to give up on the SMPS for a while. I will power my design using two coin cells and the LDO regulator already mounted in the Arduino Pro Mini. Less efficient but much easier to use.
I’ll come back to the SMPS when I have more time to investigate and read more about SMPS design and troubleshooting.
So now I think I’m going to order a Cypress FX2 CY7C68013 breakout card and read a little bit more about the FX2 – FPGA interface using the GPIF on Kalen’s thesis and reading gnu radio source code (there are some clues on the FAQ about which source files to look first).
I think it was about time to change theme. I opted for Sandbox, I like the clean look. I was surprised on how well the change theme procedure was, just switch theme and the sidebar (with all the widgets) it’s still there.
A couple of day ago, I stumbled on GNU Radio. I was looking around electrokit online shop searching for components and I saw a Cyclone IIIFPGA Starter Kit for 1599 SEK (2000 SEK including taxes) and I thought : “uhmm, I could put one of this to some use” I was thinking that maybe there was a way to implement ZibBee radio using one of these FPGAs. So I started searching google about FPGAs and radio and I found GNU Radio.
GNU Radio is a really good idea. You can get a really good explanation about GNU Radio in the GNU Radio site. But the quick explanation is that you to signal processing in the PC by using something called an USRP that is a board that has an USB interface towards the PC, a FPGA and ADC, then you connect some RF frontend(s) (daughterboards) to the USRP. The RF frontend tunes the signal and puts in baseband, the ADC digitizes the signal and the FPGA runs a DDC (Digital down converter) and sends the samples to the PC via the USB controller.
It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.
I definitely will use those additional USARTS. The lack of a second USART was the main drawback of previous Arduinos for me.
In the past days I published a couple of arduino libraries. All coming from by XBee sensor development. I’m still waiting for the MAX756 to arrive from Futurlec, I need the MAX756 to power the xbee sensor with batteries and mount it in its final position. So in the meanwhile I’m cleaning a little bit the code, moving thing to libraries, etc. Now it’s the turn of the MMA7260Q, (see other posts about MMA7260q) .
<span class='line'>#include "mma7260q.h"
</span><span class='line'>
</span><span class='line'>//set up MMA7260Q
</span><span class='line'>Mma7260q mma7260q = Mma7260q(0,1,2);
</span><span class='line'>
</span><span class='line'>long time = millis();
</span><span class='line'>
</span><span class='line'>void setup() {
</span><span class='line'>
</span><span class='line'> Serial.begin(9600);
</span><span class='line'> delay(100);
</span><span class='line'>
</span><span class='line'>
</span><span class='line'> //initial calibration of the MMA7260q
</span><span class='line'> // you can get the correct values for your MMA7260q
</span><span class='line'> // by running this program and copying the max and min values
</span><span class='line'> // after rotating the mma7260q 360degrees around all axis
</span><span class='line'> mma7260q.autoZeroCalibration(173,192,258);
</span><span class='line'> mma7260q.autoZeroCalibration(766,720,914);
</span><span class='line'>
</span><span class='line'>
</span><span class='line'> Serial.print("RST\r\n");delay(100);
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>
</span><span class='line'>void loop()
</span><span class='line'>{
</span><span class='line'> float rho, phi,theta;
</span><span class='line'> mma7260q.readTilt(&rho,&phi,&theta);
</span><span class='line'>
</span><span class='line'> if ((millis()-time)>2000)
</span><span class='line'> {
</span><span class='line'> time = millis();
</span><span class='line'> Serial.print("rho : ");
</span><span class='line'> printFloat(rho,3);
</span><span class='line'> Serial.print(" phi : ");
</span><span class='line'> printFloat(phi,3);
</span><span class='line'> Serial.print(" the: ");
</span><span class='line'> printFloat(theta,3);
</span><span class='line'> Serial.print("\r\n");
</span><span class='line'>
</span><span class='line'> int minx,miny,minz,maxx,maxy,maxz;
</span><span class='line'> mma7260q.getMinValues(&minx,&miny,&minz);
</span><span class='line'> mma7260q.getMaxValues(&maxx,&maxy,&maxz);
</span><span class='line'> Serial.print("minx: ");
</span><span class='line'> Serial.print((int)minx,DEC);
</span><span class='line'> Serial.print(" miny: ");
</span><span class='line'> Serial.print((int)miny,DEC);
</span><span class='line'> Serial.print(" minz: ");
</span><span class='line'> Serial.print((int)minz,DEC);
</span><span class='line'> Serial.print("\r\n");
</span><span class='line'>
</span><span class='line'> Serial.print("maxx: ");
</span><span class='line'> Serial.print((int)maxx,DEC);
</span><span class='line'> Serial.print(" maxy: ");
</span><span class='line'> Serial.print((int)maxy,DEC);
</span><span class='line'> Serial.print(" maxz: ");
</span><span class='line'> Serial.print((int)maxz,DEC);
</span><span class='line'> Serial.print("\r\n");
</span><span class='line'>
</span><span class='line'> }
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>void printFloat(float value, int places) {
</span><span class='line'> // this is used to cast digits
</span><span class='line'> int digit;
</span><span class='line'> float tens = 0.1;
</span><span class='line'> int tenscount = 0;
</span><span class='line'> int i;
</span><span class='line'> float tempfloat = value;
</span><span class='line'>
</span><span class='line'> // if value is negative, set tempfloat to the abs value
</span><span class='line'> // make sure we round properly. this could use pow from
</span><span class='line'> //<math.h>, but doesn't seem worth the import
</span><span class='line'> // if this rounding step isn't here, the value 54.321 prints as
</span><span class='line'> //54.3209
</span><span class='line'>
</span><span class='line'> // calculate rounding term d: 0.5/pow(10,places)
</span><span class='line'> float d = 0.5;
</span><span class='line'> if (value < 0)
</span><span class='line'> d *= -1.0;
</span><span class='line'> // divide by ten for each decimal place
</span><span class='line'> for (i = 0; i < places; i++)
</span><span class='line'> d/= 10.0;
</span><span class='line'> // this small addition, combined with truncation will round our
</span><span class='line'> // values properly
</span><span class='line'> tempfloat += d;
</span><span class='line'>
</span><span class='line'> // first get value tens to be the large power of ten less than value
</span><span class='line'> // tenscount isn't necessary but it would be useful if you wanted
</span><span class='line'> // to know after this how many chars the number will take
</span><span class='line'>
</span><span class='line'> if (value < 0)
</span><span class='line'> tempfloat *= -1.0;
</span><span class='line'> while ((tens * 10.0) <= tempfloat) {
</span><span class='line'> tens *= 10.0;
</span><span class='line'> tenscount += 1;
</span><span class='line'> }
</span><span class='line'>
</span><span class='line'>
</span><span class='line'> // write out the negative if needed
</span><span class='line'> if (value < 0)
</span><span class='line'> Serial.print('-');
</span><span class='line'>
</span><span class='line'> if (tenscount == 0)
</span><span class='line'> Serial.print(0, DEC);
</span><span class='line'>
</span><span class='line'> for (i=0; i< tenscount; i++) {
</span><span class='line'> digit = (int) (tempfloat/tens);
</span><span class='line'> Serial.print(digit, DEC);
</span><span class='line'> tempfloat = tempfloat - ((float)digit * tens);
</span><span class='line'> tens /= 10.0;
</span><span class='line'> }
</span><span class='line'>
</span><span class='line'> // if no places after decimal, stop now and return
</span><span class='line'> if (places <= 0)
</span><span class='line'> return;
</span><span class='line'>
</span><span class='line'> // otherwise, write the point and continue on
</span><span class='line'> Serial.print('.');
</span><span class='line'>
</span><span class='line'> // now write out each decimal place by shifting digits one by one
</span><span class='line'> // into the ones place and writing the truncated value
</span><span class='line'> for (i = 0; i < places; i++) {
</span><span class='line'> tempfloat *= 10.0;
</span><span class='line'> digit = (int) tempfloat;
</span><span class='line'> Serial.print(digit,DEC);
</span><span class='line'> // once written, subtract off that digit
</span><span class='line'> tempfloat = tempfloat - (float) digit;
</span><span class='line'> }
</span><span class='line'>}</span>