<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jimmy Kueh on Medium]]></title>
        <description><![CDATA[Stories by Jimmy Kueh on Medium]]></description>
        <link>https://medium.com/@jimmykzm94?source=rss-d730a677112e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*jhtZjWyWFWQVTQDD.</url>
            <title>Stories by Jimmy Kueh on Medium</title>
            <link>https://medium.com/@jimmykzm94?source=rss-d730a677112e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 09:51:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jimmykzm94/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[When Professionalism Becomes a Tool for Hypocrisy]]></title>
            <link>https://medium.com/@jimmykzm94/when-professionalism-becomes-a-tool-for-hypocrisy-8a2139284ad7?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a2139284ad7</guid>
            <category><![CDATA[hypocrisy]]></category>
            <category><![CDATA[professionalism]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Thu, 15 Oct 2026 08:06:15 GMT</pubDate>
            <atom:updated>2026-10-15T08:06:35.861Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HK-Cbb9qFRQZwncjmxMEPA.jpeg" /></figure><p>I used to think professionalism was simple.</p><p>Be respectful. Do your job properly. Communicate clearly. Control your emotions. Take responsibility for your mistakes. Treat people fairly even when you disagree with them.</p><p>I still believe in all of that.</p><p>What I have started questioning is not professionalism itself.</p><p>It is the way people use the word.</p><p>Because sometimes “professionalism” stops being a standard of behaviour and becomes a weapon.</p><p>Someone behaves disrespectfully toward you.</p><p>Someone dismisses your opinion without listening.</p><p>Someone publicly blames you for something you did not do.</p><p>Someone changes an agreement and later acts as though you failed to follow the original requirement.</p><p>Someone uses authority to talk down to you.</p><p>You confront them.</p><p>And suddenly, the conversation is no longer about what they did.</p><p>It is about whether <strong>you were professional enough when you confronted them</strong>.</p><p>That is the hypocrisy I want to talk about.</p><h3>Professionalism Is Supposed to Be Mutual</h3><p>If professionalism is a genuine standard, then it should apply to everyone.</p><p>That sounds obvious.</p><p>But in reality, it is often applied very differently depending on who has more authority, who has more social influence, or who is better at presenting themselves.</p><p>A manager can speak aggressively and be described as “direct.”</p><p>An employee confronts the manager with the same level of directness and suddenly has an “attitude problem.”</p><p>A senior person can interrupt repeatedly because they are “challenging the discussion.”</p><p>A junior person confronts that behaviour and is told they need to “learn how to communicate professionally.”</p><p>Someone in authority becomes visibly angry and people excuse it as pressure.</p><p>Someone lower in the hierarchy becomes angry while confronting unfair treatment, and their emotional control becomes the issue.</p><p>The behaviour may be almost identical.</p><p>The interpretation is not.</p><p>That is when I begin to question what people really mean when they talk about professionalism.</p><p>Do they actually mean respectful behaviour?</p><p>Or do they sometimes mean:</p><p><strong>Know your position.</strong></p><h3>Why Is Confrontation Treated as the Problem?</h3><p>I do not believe confrontation is automatically unprofessional.</p><p>In fact, sometimes confrontation is necessary.</p><p>If someone misrepresents my work, I should be able to confront them.</p><p>If someone blames me for something I did not do, I should be able to confront that accusation.</p><p>If someone repeatedly ignores an agreement, I should be able to confront the behaviour directly.</p><p>If someone speaks disrespectfully to me, I should be able to tell them that the way they are speaking to me is unacceptable.</p><p>If a manager makes a decision and later tries to shift responsibility onto someone else, that person should be allowed to confront the situation.</p><p>Yet confrontation is often treated as though it is inherently negative.</p><p>People say:</p><p>“You should not confront them like that.”</p><p>“You could have handled it more professionally.”</p><p>“You should have stayed calm.”</p><p>“You should have spoken to them privately.”</p><p>“You should have chosen a better time.”</p><p>Sometimes those criticisms are reasonable.</p><p>But sometimes they become a way of avoiding the actual issue.</p><p>The question should not only be:</p><p><strong>How did you confront them?</strong></p><p>It should also be:</p><p><strong>Why did confrontation become necessary in the first place?</strong></p><h3>The Person Who Reacts Often Gets Judged More Than the Person Who Provoked Them</h3><p>There is something strange about the way conflict is often evaluated.</p><p>Imagine someone repeatedly talks down to another person.</p><p>The other person tolerates it the first time.</p><p>Then the second.</p><p>Then the third.</p><p>Eventually, they confront the person openly.</p><p>Maybe their tone becomes sharper.</p><p>Maybe they show frustration.</p><p>Maybe they stop trying to make the conversation comfortable.</p><p>Now everyone notices.</p><p>The original behaviour may have happened quietly over weeks or months.</p><p>The confrontation happens once, visibly.</p><p>And suddenly the confrontation becomes the story.</p><p>“Why did you react like that?”</p><p>“Why did you confront them in front of everyone?”</p><p>“You could have handled that more professionally.”</p><p>“You need to control your emotions.”</p><p>Perhaps the person could have handled it better.</p><p>But why does the analysis begin at the confrontation?</p><p>Why not ask what happened before it?</p><p>Why was the original behaviour tolerated?</p><p>Why was the burden of emotional control placed almost entirely on the person who finally confronted the problem?</p><p>Of course, being mistreated does not justify doing absolutely anything in response.</p><p>There are still boundaries.</p><p>But there is a difference between saying:</p><p>“You should not have insulted that person.”</p><p>and saying:</p><p>“Because your confrontation was imperfect, we no longer need to discuss what they did to you.”</p><p>The second one is convenient.</p><p>Especially for the person who caused the problem.</p><h3>Confrontation Does Not Mean Aggression</h3><p>One reason people react negatively to the word “confront” is that they often imagine shouting, insults, threats, or humiliation.</p><p>That is not what I mean.</p><p>Confrontation can simply mean refusing to let something pass without addressing it.</p><p>It can mean saying:</p><p>“That is not what happened.”</p><p>It can mean saying:</p><p>“We agreed on something different.”</p><p>It can mean saying:</p><p>“I do not accept the way you are speaking to me.”</p><p>It can mean saying:</p><p>“You are blaming me for a decision that was not mine.”</p><p>It can mean asking someone to explain their behaviour directly instead of silently tolerating it.</p><p>Confrontation can be calm.</p><p>It can be factual.</p><p>It can also contain emotion.</p><p>The important point is that confrontation itself should not be treated as evidence of unprofessionalism.</p><p>Sometimes avoiding confrontation is the easier choice.</p><p>But easier does not always mean better.</p><h3>Politeness Is Not the Same as Professionalism</h3><p>One of the easiest mistakes to make is assuming that the calmest person in the room is automatically the most professional.</p><p>That is not necessarily true.</p><p>A person can speak quietly while humiliating someone.</p><p>They can smile while deliberately excluding someone.</p><p>They can write an extremely polite email while shifting blame onto another person.</p><p>They can say:</p><p>“Thank you for your feedback.”</p><p>while having absolutely no intention of considering it.</p><p>They can say:</p><p>“We encourage open communication.”</p><p>while becoming uncomfortable the moment someone openly disagrees.</p><p>They can say:</p><p>“We welcome different perspectives.”</p><p>while rewarding only the people who agree with the dominant view.</p><p>Everything sounds professional.</p><p>The language is polished.</p><p>The tone is controlled.</p><p>But the underlying behaviour can still be dishonest, manipulative, dismissive, or unfair.</p><p>And if someone confronts that behaviour directly, which person is actually being unprofessional?</p><p>The person hiding behind polished language?</p><p>Or the person pointing out what is happening?</p><p>The answer is not always obvious.</p><p>Professional language is useful.</p><p>But professional language should not become camouflage.</p><p>A polite person can behave badly.</p><p>A direct person can behave responsibly.</p><p>Tone matters, but tone is not the entire moral content of a conversation.</p><h3>Sometimes “Be Professional” Actually Means “Do Not Confront Me”</h3><p>This is where I think the word becomes especially interesting.</p><p>Sometimes people do not use “professional” to mean:</p><p>“Treat others respectfully.”</p><p>They use it to mean:</p><p>“Do not challenge me this directly.”</p><p>Or even:</p><p>“Do not confront me.”</p><p>That is very different.</p><p>You can see it in conversations where everyone already knows something is wrong.</p><p>A decision makes no sense.</p><p>Someone is being treated unfairly.</p><p>A manager is clearly avoiding responsibility.</p><p>A process is obviously broken.</p><p>But everyone continues speaking around the problem.</p><p>They use careful words.</p><p>They avoid saying what everybody is thinking.</p><p>They maintain the appearance of harmony.</p><p>Then someone finally confronts the issue directly.</p><p>Suddenly that person becomes the uncomfortable one.</p><p>Not necessarily because they are wrong.</p><p>But because they broke the performance.</p><p>That is when “professionalism” can become less about good behaviour and more about maintaining a socially acceptable surface.</p><p>And sometimes the surface is more important to people than the truth underneath it.</p><h3>We Say We Want Honesty — Until Someone Confronts Us</h3><p>Many workplaces claim they value honesty.</p><p>They value feedback.</p><p>They value open communication.</p><p>They want employees who “speak up.”</p><p>But there is often an invisible condition attached:</p><p>Speak up in the right way.</p><p>At the right time.</p><p>To the right person.</p><p>Using the right words.</p><p>Without making anyone important feel threatened.</p><p>And preferably without confronting anyone too directly.</p><p>There is nothing inherently wrong with choosing the right time or communicating carefully.</p><p>Those are useful skills.</p><p>The hypocrisy appears when an organisation publicly celebrates openness but privately punishes people for actually confronting problems.</p><p>At that point, the message is not really:</p><p>“Speak up.”</p><p>It is:</p><p>“Speak up, but not in a way that forces anyone powerful to answer uncomfortable questions.”</p><p>Those are not the same thing.</p><h3>Open Confrontation Can Sometimes Be Necessary</h3><p>I do not believe every problem should immediately become a confrontation.</p><p>Some misunderstandings can be resolved quietly.</p><p>Some disagreements are trivial.</p><p>Sometimes letting something go is the more sensible decision.</p><p>But there are also situations where I would rather confront someone openly than pretend nothing happened.</p><p>If someone publicly criticises my work unfairly, I may respond publicly.</p><p>If someone makes a false claim about something I did, I may correct it immediately.</p><p>If someone repeatedly crosses a boundary after being warned, I may confront them directly.</p><p>I do not believe I should always be required to hide my disagreement behind perfectly polished language.</p><p>That does not mean I want conflict for the sake of conflict.</p><p>It means I do not believe avoiding confrontation is automatically a virtue.</p><p>Sometimes avoiding confrontation simply protects the person causing the problem.</p><h3>How We Confront Still Matters</h3><p>There is an important distinction here.</p><p>Defending confrontation does not mean defending every form of confrontation.</p><p>There is a difference between:</p><p>“You are incompetent.”</p><p>and:</p><p>“We agreed on this requirement earlier. If the requirement has changed, that is fine, but it should not now be presented as an implementation failure.”</p><p>Both are confrontational.</p><p>But one attacks the person.</p><p>The other confronts the behaviour and the facts.</p><p>That distinction matters.</p><p>If I confront somebody, ideally I want the argument to remain about what actually happened.</p><p>If I turn it into personal insults, I make it easier for everyone to forget the original problem and focus on my behaviour instead.</p><p>This is not because I believe I must appear perfectly professional at every second.</p><p>It is because effective confrontation should make the issue harder to avoid, not easier.</p><p>The goal should not be:</p><p><strong>Never confront anyone.</strong></p><p>The goal should be:</p><p><strong>Know what you are confronting, why you are confronting it, and make sure the confrontation stays focused on the actual problem.</strong></p><h3>There Is a Difference Between Authenticity and Losing Control</h3><p>I do not believe people should use “I am just being honest” as an excuse to say anything they want.</p><p>That creates another problem.</p><p>Being direct does not require humiliating someone.</p><p>Being angry does not require becoming abusive.</p><p>Confronting someone does not require attacking their intelligence or character.</p><p>There is still value in restraint.</p><p>But restraint should be a tool we choose because it helps us communicate more effectively.</p><p>It should not become a demand that people erase every visible human reaction.</p><p>Sometimes anger is reasonable.</p><p>Sometimes frustration is understandable.</p><p>Sometimes someone has been pushed too far.</p><p>A person showing emotion while confronting a problem does not automatically make their position less valid.</p><p>We should be careful about a workplace culture where the appearance of emotional neutrality becomes more important than understanding why the confrontation happened.</p><h3>Competence and Professional Image Are Not the Same Thing</h3><p>Another reason professionalism can feel strange is that workplaces often mix together several completely different things.</p><p>Competence.</p><p>Communication.</p><p>Personality.</p><p>Conformity.</p><p>Political awareness.</p><p>Emotional control.</p><p>Appearance.</p><p>All of these can affect how someone is perceived.</p><p>But they are not the same.</p><p>Someone can be technically excellent and communicate badly.</p><p>Someone can communicate beautifully and understand very little.</p><p>Someone can be extremely competent but uncomfortable with corporate social rituals.</p><p>Someone else can master those rituals while producing mediocre work.</p><p>Yet the person who looks more “professional” may still be judged more favourably.</p><p>This does not mean communication skills are unimportant.</p><p>They are important.</p><p>People have to work together.</p><p>Technical ability alone does not excuse treating colleagues badly.</p><p>But we should also be honest about the reverse:</p><p>A polished communication style does not prove competence, integrity, fairness, or good judgment.</p><p>And the willingness to confront someone does not prove a lack of professionalism.</p><p>Sometimes it simply means the person is unwilling to participate in the performance.</p><h3>Power Changes Who Is Allowed to Confront Whom</h3><p>This is probably the part that bothers me most.</p><p>Professionalism sounds neutral.</p><p>Power is not.</p><p>A senior person can often afford to confront someone directly.</p><p>A junior person usually has to calculate the consequences.</p><p>A manager can question an employee aggressively and call it accountability.</p><p>An employee who confronts the manager may be described as difficult.</p><p>A manager can decide whether to forgive someone’s tone.</p><p>An employee rarely has the same authority to judge the manager.</p><p>That changes everything.</p><p>When two people with very different levels of power have a conflict, asking both of them to “be professional” may sound fair.</p><p>But if only one of them faces serious consequences for confrontation, then the standard is not actually operating equally.</p><p>That does not mean everyone with less power is automatically right.</p><p>It means we should pay attention to how professional expectations are enforced.</p><p>Who gets to confront?</p><p>Who is expected to remain silent?</p><p>Who gets described as passionate?</p><p>Who gets described as emotional?</p><p>Who is direct?</p><p>Who is difficult?</p><p>Who is assertive?</p><p>Who has an attitude?</p><p>Those words are not always applied objectively.</p><h3>Professionalism Should Not Mean Submission</h3><p>This may be the most important distinction for me.</p><p>A professional employee should be able to disagree.</p><p>A professional employee should be able to question a decision.</p><p>A professional employee should be able to defend their work.</p><p>A professional employee should be able to confront another person when necessary.</p><p>A professional employee should be able to say:</p><p>“No, that is not what happened.”</p><p>A professional employee should be able to say:</p><p>“I disagree with that decision.”</p><p>A professional employee should be able to say:</p><p>“You are blaming me for something that was not my responsibility.”</p><p>A professional employee should be able to tell someone:</p><p>“I do not think the way you are speaking to me is acceptable.”</p><p>Professionalism should not require submission.</p><p>It should not require agreeing with authority.</p><p>It should not require hiding every negative emotion.</p><p>And it definitely should not require accepting behaviour from another person simply because confronting that behaviour may create discomfort.</p><p>Sometimes discomfort is exactly what accountability feels like.</p><h3>So What Should Professionalism Actually Mean?</h3><p>I do not want to throw away the idea of professionalism.</p><p>I want it to mean something.</p><p>To me, professionalism should include things such as:</p><p>Doing your work responsibly.</p><p>Being honest about mistakes.</p><p>Treating people with basic respect.</p><p>Not deliberately humiliating others.</p><p>Communicating disagreement clearly.</p><p>Taking responsibility for your decisions.</p><p>Respecting people’s boundaries.</p><p>Not abusing authority.</p><p>Not hiding behind hierarchy.</p><p>Being willing to confront problems instead of pretending they do not exist.</p><p>And being willing to accept confrontation yourself if you expect others to accept criticism from you.</p><p>Most importantly, the standard should apply in both directions.</p><p>If you demand professionalism from others, you should be prepared to practise it yourself.</p><p>If you want people to remain respectful when they disagree with you, then remain respectful when you disagree with them.</p><p>If you expect people to accept feedback, then do not become defensive when they confront you with feedback.</p><p>If you want employees to speak openly, do not punish them simply because their confrontation makes you uncomfortable.</p><p>That is what makes professionalism credible.</p><h3>The Problem Is Not Professionalism</h3><p>The more I think about it, the less I believe professionalism itself is hypocritical.</p><p>The hypocrisy comes from how selectively people use it.</p><p>Professionalism becomes hypocritical when someone demands restraint from others but not from themselves.</p><p>It becomes hypocritical when politeness is valued more than honesty.</p><p>It becomes hypocritical when authority is allowed to behave badly while the person confronting that behaviour is judged for their tone.</p><p>It becomes hypocritical when “open communication” is encouraged only until someone actually confronts an uncomfortable problem.</p><p>It becomes hypocritical when the word is used to avoid discussing the behaviour that caused a conflict in the first place.</p><p>And it becomes dangerous when people start believing that appearing professional is more important than behaving responsibly.</p><p>I still believe professionalism matters.</p><p>But I think we should question it whenever the word is used to end a discussion instead of examining what actually happened.</p><p>Sometimes “be professional” is good advice.</p><p>Sometimes it is a reasonable reminder to control ourselves.</p><p>And sometimes it is simply a more socially acceptable way of saying:</p><p><strong>Do not confront me.</strong></p><p>Those situations should not be confused.</p><p>Because professionalism should help people deal with conflict honestly.</p><p>It should not protect people from being confronted.</p><p>And it should never become a tool for escaping accountability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a2139284ad7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Development in VS Code: A Practical Guide]]></title>
            <link>https://medium.com/@jimmykzm94/flutter-development-in-vs-code-a-practical-guide-cb3f9d0fdc84?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb3f9d0fdc84</guid>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Wed, 09 Sep 2026 08:45:57 GMT</pubDate>
            <atom:updated>2026-09-09T08:45:57.757Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ekPGcUuLA8-XxMICDt7E5w.jpeg" /></figure><p>Flutter and Visual Studio Code provide a fast and productive development experience. With the official Flutter extension, you can create projects, run applications, debug, and use Hot Reload without leaving the editor.</p><p>This guide focuses on developing Flutter applications in VS Code. Installation and platform-specific setup are covered by the official documentation and should always be referenced, as they are kept up to date.</p><h3>1. Set Up Flutter</h3><p>Complete the Flutter setup by following the official documentation:</p><h4>Flutter Setup</h4><p>Start here for installing Flutter and configuring your development environment:</p><ul><li>Flutter installation guide: <a href="https://docs.flutter.dev/install/quick">https://docs.flutter.dev/install/quick</a></li></ul><h4>Platform-Specific Setup</h4><p>Depending on the platforms you want to develop for, follow the additional setup guides:</p><ul><li>Android setup: <a href="https://docs.flutter.dev/platform-integration/android/setup">https://docs.flutter.dev/platform-integration/android/setup</a></li><li>iOS setup: <a href="https://docs.flutter.dev/platform-integration/ios/setup">https://docs.flutter.dev/platform-integration/ios/setup</a></li><li>Web setup: <a href="https://docs.flutter.dev/platform-integration/web/setup">https://docs.flutter.dev/platform-integration/web/setup</a></li><li>and etc.</li></ul><p>Once the setup is complete, open your Flutter project in VS Code.</p><h3>2. Verify Your Environment</h3><p>Open the integrated terminal in VS Code and run:</p><pre>flutter doctor</pre><p>Resolve any issues reported before starting development. A healthy environment ensures Flutter can detect your SDK, connected devices, and development tools correctly.</p><h3>3. Create a Flutter Project</h3><p>There are two common ways to create a Flutter project.</p><h4>Using the Command Palette</h4><ol><li>Open the Command Palette (Ctrl+Shift+P).</li><li>Search for <strong>Flutter: New Project</strong>.</li><li>Select <strong>Application</strong>.</li><li>Choose a location and enter a project name.</li></ol><h4>Using the Terminal</h4><pre>flutter create my_first_app</pre><p>Open the project folder in VS Code.</p><p>A typical Flutter project includes:</p><ul><li>lib/ – application source code</li><li>android/ and ios/ – platform-specific projects</li><li>pubspec.yaml – project configuration and dependencies</li></ul><h3>4. Run Your Application</h3><p>Connect a physical device or start an emulator.</p><p>You can launch the application by:</p><ul><li>Pressing <strong>F5</strong> to start debugging.</li><li>Selecting <strong>Run &gt; Start Debugging</strong>.</li><li>Running the following command in the integrated terminal:</li></ul><pre>flutter run</pre><p>VS Code automatically detects available devices, allowing you to switch between them from the status bar.</p><h3>5. Hot Reload and Hot Restart</h3><p>Flutter’s development workflow is built around rapid iteration.</p><ul><li><strong>Hot Reload</strong> applies most code changes without restarting the application, making UI development significantly faster.</li><li><strong>Hot Restart</strong> restarts the Dart application while keeping the emulator or connected device running.</li></ul><p>Both features are available directly from the VS Code debug toolbar.</p><h3>6. Debugging in VS Code</h3><p>VS Code provides built-in debugging tools for Flutter applications.</p><p>Some commonly used features include:</p><ul><li>Setting breakpoints</li><li>Inspecting variables</li><li>Viewing the call stack</li><li>Using the Debug Console</li><li>Opening Dart DevTools for widget inspection and performance analysis</li></ul><p>These tools make it easier to diagnose and fix issues without leaving the editor.</p><h3>7. Helpful VS Code Features</h3><p>VS Code includes several features that improve the Flutter development experience:</p><ul><li>Device selector for switching between connected devices</li><li>Flutter Outline for navigating the widget tree</li><li>Integrated terminal for Flutter CLI commands</li><li>Source Control integration for Git workflows</li><li>Command Palette for common Flutter commands</li></ul><p>Using these features together creates an efficient development workflow.</p><h3>8. Recommended Extensions</h3><p>Beyond the Flutter extension, a few additional extensions which I think can help improve your development workflow:</p><ul><li><strong>Todo Tree</strong> — Highlights TODO, FIXME, and other task comments, making it easier to keep track of pending work.</li><li><strong>GitLens</strong> — Enhances Git integration with features such as inline blame, commit history, and repository insights.</li><li><strong>AI Coding Assistants</strong> — Tools like <strong>GitHub Copilot</strong> or <strong>OpenAI Codex</strong> can help generate boilerplate code, explain existing code, and assist with refactoring. Most AI assistants require you to sign in, and some features may require a paid subscription.</li></ul><p>Choose the extensions that fit your workflow to keep VS Code fast and uncluttered.</p><h3>9. Troubleshooting Tips</h3><p>If you encounter problems during development:</p><ul><li>Run flutter doctor to identify configuration issues.</li><li>Run flutter pub get after adding or updating dependencies.</li><li>Verify that an emulator or physical device is connected.</li><li>Restart the debug session if changes are not reflected.</li><li>Keep Flutter and the VS Code extensions up to date.</li></ul><h3>Conclusion</h3><p>VS Code is a lightweight yet powerful editor for Flutter development. Its integrated debugging tools, terminal, Hot Reload support, and Flutter-specific features provide an efficient workflow for building, testing, and debugging applications.</p><p>For installation and platform-specific configuration, always refer to the official Flutter documentation to ensure you are following the latest recommendations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb3f9d0fdc84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux command cheatsheet: tar]]></title>
            <link>https://medium.com/@jimmykzm94/linux-command-cheatsheet-tar-8a9b067bd43a?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a9b067bd43a</guid>
            <category><![CDATA[linux-commands]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 13:34:35 GMT</pubDate>
            <atom:updated>2026-07-22T13:34:35.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PrNV3VKMssjpuT1gc6ivYQ.png" /></figure><p>tar archives multiple files and directories into one file. It can also compress archives using gzip, bzip2, or xz.</p><h3>Basic Syntax</h3><pre>tar [options] archive-name files-or-directories</pre><h3>Main Operations</h3><pre>| Option | Description                          |<br>| ------ | ------------------------------------ |<br>| `-c`   | Create an archive                    |<br>| `-x`   | Extract an archive                   |<br>| `-t`   | List archive contents                |<br>| `-r`   | Append files to an archive           |<br>| `-u`   | Add files newer than archived copies |<br>| `-f`   | Specify the archive filename         |<br>| `-v`   | Show processed files                 |</pre><p>Only use one main operation at a time: -c, -x, -t, -r, or -u.</p><h3>Create an Archive</h3><pre>tar -cf archive.tar file1.txt file2.txt</pre><p>Archive a directory:</p><pre>tar -cf project.tar project/</pre><p>Show files while archiving:</p><pre>tar -cvf project.tar project/</pre><h3>Extract an Archive</h3><pre>tar -xf archive.tar</pre><p>Extract with verbose output:</p><pre>tar -xvf archive.tar</pre><p>Extract into another directory:</p><pre>tar -xf archive.tar -C /path/to/destination</pre><p>The destination directory must already exist.</p><h3>List Archive Contents</h3><pre>tar -tf archive.tar</pre><p>Detailed listing:</p><pre>tar -tvf archive.tar</pre><h3>Compression Options</h3><pre>| Option | Compression | Common extension  |<br>| ------ | ----------- | ----------------- |<br>| `-z`   | gzip        | `.tar.gz`, `.tgz` |<br>| `-j`   | bzip2       | `.tar.bz2`        |<br>| `-J`   | xz          | `.tar.xz`         |</pre><h3>Create Compressed Archives</h3><p>Create a gzip archive:</p><pre>tar -czf archive.tar.gz directory/</pre><p>Create a bzip2 archive:</p><pre>tar -cjf archive.tar.bz2 directory/</pre><p>Create an xz archive:</p><pre>tar -cJf archive.tar.xz directory/</pre><p>With verbose output:</p><pre>tar -czvf archive.tar.gz directory/</pre><h3>Extract Compressed Archives</h3><p>Extract gzip:</p><pre>tar -xzf archive.tar.gz</pre><p>Extract bzip2:</p><pre>tar -xjf archive.tar.bz2</pre><p>Extract xz:</p><pre>tar -xJf archive.tar.xz</pre><p>Modern versions of tar can often detect compression automatically:</p><pre>tar -xf archive.tar.gz</pre><h3>Extract Specific Files</h3><pre>tar -xf archive.tar path/to/file.txt</pre><p>Extract multiple files:</p><pre>tar -xf archive.tar file1.txt file2.txt</pre><p>The file path must match the path stored inside the archive.</p><h3>Extract Matching Files</h3><pre>tar -xf archive.tar --wildcards &quot;*.log&quot;</pre><p>Extract files from a specific directory:</p><pre>tar -xf archive.tar --wildcards &quot;logs/*&quot;</pre><h3>Exclude Files</h3><p>Exclude one file:</p><pre>tar -czf archive.tar.gz directory/ --exclude=&quot;directory/file.log&quot;</pre><p>Exclude a pattern:</p><pre>tar -czf archive.tar.gz directory/ --exclude=&quot;*.log&quot;</pre><p>Exclude multiple patterns:</p><pre>tar -czf archive.tar.gz directory/ \<br>  --exclude=&quot;*.log&quot; \<br>  --exclude=&quot;node_modules&quot; \<br>  --exclude=&quot;.git&quot;</pre><h3>Remove Leading Directories</h3><p>Remove one directory level during extraction:</p><pre>tar -xf archive.tar --strip-components=1</pre><p>Example stored path:</p><pre>project/src/main.c</pre><p>After --strip-components=1:</p><pre>src/main.c</pre><h3>Preserve Permissions</h3><p>Preserve file permissions during extraction:</p><pre>tar -xpf archive.tar</pre><p>This is often most relevant when running as root.</p><h3>Keep Existing Files</h3><p>Do not overwrite existing files:</p><pre>tar -xf archive.tar --keep-old-files</pre><p>Skip existing files without reporting an error:</p><pre>tar -xf archive.tar --skip-old-files</pre><h3>Overwrite Existing Files</h3><pre>tar -xf archive.tar --overwrite</pre><p>Use carefully because existing files may be replaced.</p><h3>Append Files</h3><p>Append a file to an uncompressed archive:</p><pre>tar -rf archive.tar new-file.txt</pre><p>Append a directory:</p><pre>tar -rf archive.tar new-directory/</pre><p>Appending directly to compressed archives is generally not supported.</p><h3>Update an Archive</h3><p>Add files only when they are newer than the archived versions:</p><pre>tar -uf archive.tar directory/</pre><h3>Delete from an Archive</h3><pre>tar --delete -f archive.tar path/to/file.txt</pre><p>This generally works only with uncompressed archives.</p><h3>Read Files from Standard Input</h3><p>Archive filenames listed in a text file:</p><pre>tar -cf archive.tar -T files.txt</pre><p>Example files.txt:</p><pre>file1.txt<br>file2.txt<br>documents/</pre><h3>Write an Archive to Standard Output</h3><pre>tar -czf - directory/ &gt; archive.tar.gz</pre><p>Send an archive through SSH:</p><pre>tar -czf - directory/ | ssh user@server &quot;cat &gt; archive.tar.gz&quot;</pre><p>Archive a remote directory locally:</p><pre>ssh user@server &quot;tar -czf - /path/to/directory&quot; &gt; backup.tar.gz</pre><h3>Change Directory Before Archiving</h3><pre>tar -czf archive.tar.gz -C /var/www project/</pre><p>This archives:</p><pre>project/</pre><p>Instead of storing the full path:</p><pre>/var/www/project/</pre><h3>Common Backup Command</h3><pre>tar -czvf backup-$(date +%Y-%m-%d).tar.gz \<br>  --exclude=&quot;*.log&quot; \<br>  --exclude=&quot;cache&quot; \<br>  /path/to/data</pre><h3>Inspect Before Extracting</h3><p>Always inspect unknown archives first:</p><pre>tar -tf archive.tar.gz</pre><p>Then extract:</p><pre>tar -xf archive.tar.gz</pre><h3>Common Command Patterns</h3><pre># Create<br>tar -cvf archive.tar directory/</pre><pre># Create with gzip<br>tar -czvf archive.tar.gz directory/</pre><pre># Extract<br>tar -xvf archive.tar</pre><pre># Extract compressed archive<br>tar -xzvf archive.tar.gz</pre><pre># List contents<br>tar -tvf archive.tar</pre><pre># Extract somewhere else<br>tar -xf archive.tar -C /destination/</pre><pre># Exclude files<br>tar -czf archive.tar.gz directory/ --exclude=&quot;*.log&quot;</pre><pre># Remove the first path level<br>tar -xf archive.tar --strip-components=1</pre><h3>Option Order</h3><p>These commands are equivalent:</p><pre>tar -czvf archive.tar.gz directory/</pre><pre>tar czvf archive.tar.gz directory/</pre><p>Using the leading hyphen is clearer and more consistent with other Linux commands.</p><h3>Important Notes</h3><ul><li>tar combines files; compression is handled by gzip, bzip2, or xz.</li><li>Use -f immediately before the archive filename.</li><li>Use -C to control where files are archived from or extracted to.</li><li>Inspect unfamiliar archives before extracting them.</li><li>Avoid extracting untrusted archives as root.</li><li>Be careful with absolute paths and files containing ../.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a9b067bd43a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux command cheatsheet: sed]]></title>
            <link>https://medium.com/@jimmykzm94/linux-command-cheatsheet-sed-de672bd31caa?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/de672bd31caa</guid>
            <category><![CDATA[linux-commands]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 13:34:17 GMT</pubDate>
            <atom:updated>2026-07-22T13:34:17.403Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LPRrFaYtuVjr1R2IOSMyzQ.png" /></figure><p>sed is a stream editor used to search, replace, delete, insert, and transform text.</p><h3>Basic Syntax</h3><pre>sed [options] &#39;command&#39; file</pre><p>By default, sed prints the result without changing the original file.</p><h3>Replace Text</h3><p>Replace the first match on each line:</p><pre>sed &#39;s/old/new/&#39; file.txt</pre><p>Replace every match:</p><pre>sed &#39;s/old/new/g&#39; file.txt</pre><p>Replace only the second match:</p><pre>sed &#39;s/old/new/2&#39; file.txt</pre><p>Case-insensitive replacement with GNU sed:</p><pre>sed &#39;s/error/warning/gI&#39; file.txt</pre><h3>Edit a File In Place</h3><pre>sed -i &#39;s/old/new/g&#39; file.txt</pre><p>Create a backup before editing:</p><pre>sed -i.bak &#39;s/old/new/g&#39; file.txt</pre><p>macOS/BSD sed requires an extension after -i:</p><pre>sed -i &#39;&#39; &#39;s/old/new/g&#39; file.txt</pre><h3>Use a Different Delimiter</h3><p>Useful when replacing paths or URLs:</p><pre>sed &#39;s|/old/path|/new/path|g&#39; file.txt</pre><p>Other characters can also be used:</p><pre>sed &#39;s#https://old.com#https://new.com#g&#39; file.txt</pre><h3>Print Specific Lines</h3><p>Print line 5:</p><pre>sed -n &#39;5p&#39; file.txt</pre><p>Print lines 5 through 10:</p><pre>sed -n &#39;5,10p&#39; file.txt</pre><p>Print the last line:</p><pre>sed -n &#39;$p&#39; file.txt</pre><p>Print lines matching a pattern:</p><pre>sed -n &#39;/error/p&#39; file.txt</pre><h3>Delete Lines</h3><p>Delete line 5:</p><pre>sed &#39;5d&#39; file.txt</pre><p>Delete lines 5 through 10:</p><pre>sed &#39;5,10d&#39; file.txt</pre><p>Delete the last line:</p><pre>sed &#39;$d&#39; file.txt</pre><p>Delete empty lines:</p><pre>sed &#39;/^$/d&#39; file.txt</pre><p>Delete lines containing a word:</p><pre>sed &#39;/debug/d&#39; file.txt</pre><p>Delete comment lines:</p><pre>sed &#39;/^[[:space:]]*#/d&#39; file.txt</pre><h3>Insert and Append Text</h3><p>Insert text before line 3:</p><pre>sed &#39;3i\New text&#39; file.txt</pre><p>Append text after line 3:</p><pre>sed &#39;3a\New text&#39; file.txt</pre><p>Insert before matching lines:</p><pre>sed &#39;/error/i\Warning:&#39; file.txt</pre><p>Append after matching lines:</p><pre>sed &#39;/error/a\Check this line&#39; file.txt</pre><h3>Replace an Entire Line</h3><p>Replace line 3:</p><pre>sed &#39;3c\Replacement text&#39; file.txt</pre><p>Replace lines matching a pattern:</p><pre>sed &#39;/localhost/c\127.0.0.1 example.com&#39; file.txt</pre><h3>Work with Line Ranges</h3><p>Replace text only between lines 5 and 10:</p><pre>sed &#39;5,10s/old/new/g&#39; file.txt</pre><p>Delete text between two patterns:</p><pre>sed &#39;/START/,/END/d&#39; file.txt</pre><p>Print text between two patterns:</p><pre>sed -n &#39;/START/,/END/p&#39; file.txt</pre><h3>Remove Whitespace</h3><p>Remove leading whitespace:</p><pre>sed &#39;s/^[[:space:]]*//&#39; file.txt</pre><p>Remove trailing whitespace:</p><pre>sed &#39;s/[[:space:]]*$//&#39; file.txt</pre><p>Remove both:</p><pre>sed &#39;s/^[[:space:]]*//; s/[[:space:]]*$//&#39; file.txt</pre><p>Replace multiple spaces with one space:</p><pre>sed &#39;s/[[:space:]]\+/ /g&#39; file.txt</pre><p>For portable extended patterns:</p><pre>sed -E &#39;s/[[:space:]]+/ /g&#39; file.txt</pre><h3>Capture Groups</h3><p>Swap two words:</p><pre>echo &quot;hello world&quot; | sed -E &#39;s/(hello) (world)/\2 \1/&#39;</pre><p>Output:</p><pre>world hello</pre><p>Wrap matching text:</p><pre>sed -E &#39;s/([0-9]+)/[\1]/g&#39; file.txt</pre><h3>Add Text to Every Line</h3><p>Add a prefix:</p><pre>sed &#39;s/^/PREFIX: /&#39; file.txt</pre><p>Add a suffix:</p><pre>sed &#39;s/$/ :SUFFIX/&#39; file.txt</pre><p>Add line numbers:</p><pre>sed = file.txt | sed &#39;N; s/\n/ /&#39;</pre><h3>Multiple Commands</h3><p>Use multiple -e options:</p><pre>sed -e &#39;s/foo/bar/g&#39; -e &#39;/debug/d&#39; file.txt</pre><p>Or separate commands with semicolons:</p><pre>sed &#39;s/foo/bar/g; /debug/d&#39; file.txt</pre><p>Use a script file:</p><pre>sed -f commands.sed file.txt</pre><p>Example commands.sed:</p><pre>s/foo/bar/g<br>/debug/d</pre><h3>Use with Pipes</h3><p>Replace text from another command:</p><pre>printf &#39;%s\n&#39; &quot;hello world&quot; | sed &#39;s/world/Linux/&#39;</pre><p>Filter command output:</p><pre>ps aux | sed -n &#39;1,5p&#39;</pre><p>Remove comments and empty lines:</p><pre>cat config.conf |<br>  sed &#39;/^[[:space:]]*#/d; /^[[:space:]]*$/d&#39;</pre><h3>Common Options</h3><pre>| Option | Description                      |<br>| ------ | -------------------------------- |<br>| `-n`   | Disable automatic output         |<br>| `-i`   | Edit files in place              |<br>| `-e`   | Add a command                    |<br>| `-f`   | Read commands from a file        |<br>| `-E`   | Use extended regular expressions |</pre><h3>Common Patterns</h3><pre># Replace all matches<br>sed &#39;s/old/new/g&#39; file.txt</pre><pre># Edit in place with backup<br>sed -i.bak &#39;s/old/new/g&#39; file.txt</pre><pre># Print matching lines<br>sed -n &#39;/pattern/p&#39; file.txt</pre><pre># Delete matching lines<br>sed &#39;/pattern/d&#39; file.txt</pre><pre># Print a line range<br>sed -n &#39;10,20p&#39; file.txt</pre><pre># Remove empty lines<br>sed &#39;/^[[:space:]]*$/d&#39; file.txt</pre><pre># Remove comments<br>sed &#39;/^[[:space:]]*#/d&#39; file.txt</pre><pre># Trim whitespace<br>sed &#39;s/^[[:space:]]*//; s/[[:space:]]*$//&#39; file.txt</pre><pre># Replace only on matching lines<br>sed &#39;/pattern/s/old/new/g&#39; file.txt</pre><h3>Important Notes</h3><ul><li>sed does not modify files unless -i is used.</li><li>Use -n together with p to print only selected lines.</li><li>Use single quotes to prevent the shell from expanding special characters.</li><li>Test commands without -i before changing important files.</li><li>GNU and macOS/BSD versions of sed have small syntax differences.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de672bd31caa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ATtiny85 Finite State Machine — traffic lights]]></title>
            <link>https://medium.com/@jimmykzm94/attiny85-finite-state-machine-traffic-lights-7e25ef4b80e2?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e25ef4b80e2</guid>
            <category><![CDATA[attiny85]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Fri, 01 May 2026 01:06:01 GMT</pubDate>
            <atom:updated>2026-05-01T01:06:01.483Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uvsv1OXMw9aLQYtWNatfcA.png" /></figure><h3>What is a State Machine? 🚦</h3><p>Instead of writing a long, top-to-bottom list of instructions, a state machine organizes your program into specific “States” and waits for a trigger to “Transition” to the next one.</p><p>For our traffic light, the logic breaks down like this:</p><h4><strong>State:</strong> GREEN</h4><ul><li><strong>Action:</strong> Turn on Green LED.</li><li><strong>Transition Trigger:</strong> 5 seconds have passed. → Go to YELLOW.</li></ul><h4><strong>State:</strong> YELLOW</h4><ul><li><strong>Action:</strong> Turn on Yellow LED.</li><li><strong>Transition Trigger:</strong> 2 seconds have passed. → Go to RED.</li></ul><h4><strong>State:</strong> RED</h4><ul><li><strong>Action:</strong> Turn on Red LED.</li><li><strong>Transition Trigger:</strong> 6 seconds have passed. → Go to GREEN.</li></ul><p>Because we are using our hardware timer to track time in the background, the microcontroller doesn’t get “stuck” in any of these states. It quickly checks the current state, checks the clock, and if it isn’t time to change yet, it moves on to do other things.</p><h3>The Setup 🛠️</h3><p>We will use the same Timer0 setup from the previous post to generate a 1-millisecond tick. We’ll assign the LEDs to three pins on the ATtiny85:</p><ul><li><strong>PB0:</strong> Green LED</li><li><strong>PB1:</strong> Yellow LED</li><li><strong>PB2:</strong> Red LED</li></ul><h3>The Code 💻</h3><p>Here is how you write a clean, non-blocking FSM in C. Notice how we use a switch/case statement—this is the heart of any good state machine.</p><pre>#include &lt;avr/io.h&gt;<br>#include &lt;avr/interrupt.h&gt;<br><br>// 1. Define our States using an enum for readability<br>typedef enum {<br>    STATE_GREEN,<br>    STATE_YELLOW,<br>    STATE_RED<br>} TrafficState;<br><br>// Pin Definitions<br>#define GREEN_PIN  PB0<br>#define YELLOW_PIN PB1<br>#define RED_PIN    PB2<br><br>// Our 1ms background clock<br>volatile uint32_t ms_counter = 0;<br><br>// Interrupt Service Routine: Runs every 1 millisecond<br>ISR(TIMER0_COMPA_vect) {<br>    ms_counter++;<br>}<br><br>void setup_timer(void) {<br>    // Timer0 in CTC mode, Prescaler 64, Target 124 (for 8MHz clock)<br>    TCCR0A |= (1 &lt;&lt; WGM01); <br>    TCCR0B |= (1 &lt;&lt; CS01) | (1 &lt;&lt; CS00);<br>    OCR0A = 124;<br>    TIMSK |= (1 &lt;&lt; OCIE0A);<br>    sei(); // Enable global interrupts<br>}<br><br>// Helper function to easily switch the LEDs<br>void set_lights(uint8_t green, uint8_t yellow, uint8_t red) {<br>    if (green)  PORTB |= (1 &lt;&lt; GREEN_PIN);  else PORTB &amp;= ~(1 &lt;&lt; GREEN_PIN);<br>    if (yellow) PORTB |= (1 &lt;&lt; YELLOW_PIN); else PORTB &amp;= ~(1 &lt;&lt; YELLOW_PIN);<br>    if (red)    PORTB |= (1 &lt;&lt; RED_PIN);    else PORTB &amp;= ~(1 &lt;&lt; RED_PIN);<br>}<br><br>int main(void) {<br>    // Set PB0, PB1, and PB2 as outputs<br>    DDRB |= (1 &lt;&lt; GREEN_PIN) | (1 &lt;&lt; YELLOW_PIN) | (1 &lt;&lt; RED_PIN);<br>    <br>    setup_timer(); // Start the background clock<br><br>    // 2. Initialize the State Machine variables<br>    TrafficState current_state = STATE_RED;<br>    uint32_t state_start_time = 0;<br><br>    // Start with the Red light on<br>    set_lights(0, 0, 1); <br><br>    while (1) {<br>        // Calculate how long we&#39;ve been in the current state<br>        uint32_t elapsed_time = ms_counter - state_start_time;<br><br>        // 3. The State Machine Logic<br>        switch (current_state) {<br>            <br>            case STATE_GREEN:<br>                if (elapsed_time &gt;= 5000) {      // If 5 seconds have passed...<br>                    current_state = STATE_YELLOW; // Transition to Yellow<br>                    set_lights(0, 1, 0);          // Update hardware<br>                    state_start_time = ms_counter;// Reset the stopwatch<br>                }<br>                break;<br><br>            case STATE_YELLOW:<br>                if (elapsed_time &gt;= 2000) {      // If 2 seconds have passed...<br>                    current_state = STATE_RED;    // Transition to Red<br>                    set_lights(0, 0, 1);          // Update hardware<br>                    state_start_time = ms_counter;<br>                }<br>                break;<br><br>            case STATE_RED:<br>                if (elapsed_time &gt;= 6000) {      // If 6 seconds have passed...<br>                    current_state = STATE_GREEN;  // Transition to Green<br>                    set_lights(1, 0, 0);          // Update hardware<br>                    state_start_time = ms_counter;<br>                }<br>                break;<br>        }<br>        <br>        // Because there are no delay() functions, the loop runs thousands <br>        // of times a second! You could add code right here to read sensors.<br>    }<br>    <br>    return 0;<br>}</pre><h3>Why Write It This Way?</h3><ul><li><strong>Readability:</strong> The switch/case statement makes it incredibly obvious what is happening in each phase of the program.</li><li><strong>Scalability:</strong> Want to add a left-turn arrow? Just add a new state to the enum and a new case in the switch. You don&#39;t have to untangle a messy web of delay() functions.</li></ul><p>⚠️ When ms_counter reaches 4,294,967,295 (run about 50 days), the next 1-millisecond tick will cause an <strong>Integer Overflow</strong>. Because it is an unsigned variable (meaning it cannot go into negative numbers), it simply rolls over like a car&#39;s odometer and goes right back to 0. No rollover timer bugs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e25ef4b80e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ATtiny85 Edge AI — Logistic Regression]]></title>
            <link>https://medium.com/@jimmykzm94/attiny85-edge-ai-logistic-regression-ff40e32886b1?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff40e32886b1</guid>
            <category><![CDATA[attiny85]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 01:01:01 GMT</pubDate>
            <atom:updated>2026-04-30T01:01:01.342Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uvsv1OXMw9aLQYtWNatfcA.png" /></figure><p>What if… you can run small machine learning inference on 8-bits MCU like ATtiny85. In this post, I am going to talk about how I implemented a logistic regression model using MQ2 gas sensor on my ATtiny85.</p><p>Logistic regression is a classification algorithm that predicts a binary outcome (e.g., true/false). It first calculates a score z by taking a weighted sum of the input features (the sensor readings x) and adding a bias b.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ew-1nnsbR300ii27SgaXUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0Yy4hdLr0zTETizWDDJcQ.png" /></figure><p>A probability greater than 0.5 is classified as one outcome, while a probability less than or equal to 0.5 is classified as the other.</p><p>A key optimization is made in this project to suit the resource-constrained ATtiny85. Instead of calculating the full logistic sigmoid function, which is computationally expensive, it leverages the properties of its decision boundary. The sigmoid function’s output crosses the 0.5 probability threshold precisely when its input (z) is zero. Therefore, checking if z &gt; 0 is a direct and efficient way to classify the outcome without the overhead of floating-point math and exponential functions, saving significant memory and processing time. From the source code, where using z &gt; 0 requires only 266 bytes of flash compared to 1766 bytes for the full sigmoid function.</p><p>The main.c code initializes the ADC to read from the sensor and sets up two LEDs (green and red) for output. It collects 20 samples from the MQ2 sensor, calculates a weighted sum, and applies a bias to get a score z.</p><p>To classify the sensor reading, it checks if z &gt; 0.</p><ul><li>If z is positive, it indicates the presence of a target gas, and a red LED on PB1 lights up.</li><li>If z is not positive, a green LED on PB0 lights up.</li></ul><p>This approach serves as a memory-efficient and fast alternative to a full logistic sigmoid function for on-device AI classification.</p><h3>Steps</h3><h4>1. Collecting data</h4><p>I used Arduino UNO board to reads data from the MQ2 gas sensor and prints it to the serial monitor for collection. The data is saved in a CSV format file.</p><h4>2. Train data sample</h4><p>I wrote Python code in Jupyter Notebook to train the logistic regression model with the collected sensor data. The resulting weights and bias values are then pasted into my ATtiny85 main.c.</p><h4>3. Deploy model</h4><p>Before I deployed to the ATtiny85, I used Arduino UNO board to make real-time predictions and serves as a prototype. Finally, the weights and bias values calculated from Jupyter Notebook are then pasted into my ATtiny85 main.c.</p><h3>Demonstration video</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*pdRPBddeYvsdDTl__1jJmg.gif" /></figure><p>As you can see, the default state lights the green LED 🟢. When I released methane gas near MQ2 gas sensor, causing to turn on the red LED 🔴.</p><p>That’s it. Hope you enjoy my post.</p><p>You can find my repository here: <a href="https://github.com/jimmykzm94/attiny85-edge-ai/tree/main/logistic_mq2">https://github.com/jimmykzm94/attiny85-edge-ai/tree/main/logistic_mq2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff40e32886b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ATtiny85 Analog Comparator]]></title>
            <link>https://medium.com/@jimmykzm94/attiny85-analog-comparator-2cab84489057?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cab84489057</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[attiny85]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 01:31:01 GMT</pubDate>
            <atom:updated>2026-04-29T01:31:01.539Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uvsv1OXMw9aLQYtWNatfcA.png" /></figure><p>The Analog Comparator is a hardware peripheral that compares the voltage levels on two different pins. Unlike an ADC, which converts a voltage into a multi-bit digital number, the comparator simply outputs a binary “high” or “low” signal based on which input is greater.</p><h3>What are the Features? 🔍</h3><p>Instead of waiting for an ADC conversion cycle, the Analog Comparator continuously compares two voltages in pure hardware. Here is what it brings to the table:</p><h4>🎯 <strong>Instantaneous Comparison</strong></h4><p>The comparator continuously evaluates the positive pin (AIN0) against the negative pin (AIN1). When the voltage on the positive pin AIN0 is higher than the voltage on the negative pin AIN1, the Analog Comparator output flag is instantly set.</p><h4>🔀 <strong>Multiplexer Integration</strong></h4><p>By default, the comparator looks at AIN0 (PB0) and AIN1 (PB1). However, the chip includes a multiplexer enable feature that allows you to route any of the standard ADC channels (ADC0 through ADC3) into the negative input instead!</p><h4>🔋 <strong>Internal Bandgap Option</strong></h4><p>Don’t have a stable external reference voltage? You can swap the positive input (AIN0) for the ATtiny85’s internal, fixed 1.1V Bandgap reference. This is the classic, low-component-count way to build a low-battery voltage detector directly in hardware.</p><h4>🔔 <strong>Interrupt-Driven Triggers</strong></h4><p>You can configure the comparator to fire an interrupt when the output toggles, goes high (rising edge), or goes low (falling edge). It is perfect for waking the chip up from sleep to execute heavy mathematical equations only when an analog threshold is crossed.</p><h3>⚙️ The Registers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hGdeM7i3F0-KwQXkPc4b1A.png" /></figure><h3>💻 The Code</h3><pre>#include &lt;avr/io.h&gt;<br>#include &lt;avr/interrupt.h&gt;<br><br>void comparator_init(void) {<br>    // 1. Power Prep<br>    // Disable digital buffers on PB0 and PB1 to save energy<br>    DIDR0 |= (1 &lt;&lt; AIN0D) | (1 &lt;&lt; AIN1D);<br>    <br>    // 2. Configure ACSR<br>    // - Clear ACD to keep it powered<br>    // - Set ACIS1 and ACIS0 to 11 (Interrupt on RISING EDGE)<br>    // - Set ACIE to enable the interrupt<br>    ACSR = (1 &lt;&lt; ACIE) | (1 &lt;&lt; ACIS1) | (1 &lt;&lt; ACIS0);<br>    <br>    // 3. Enable Global Interrupts<br>    sei();<br>}<br><br>// ISR: This runs the millisecond the threshold is crossed<br>ISR(ANA_COMP_vect) {<br>    // Threshold hit! Toggle a pin or set a flag.<br>    PORTB ^= (1 &lt;&lt; PB2); <br>}<br><br>int main(void) {<br>    DDRB |= (1 &lt;&lt; PB2); // Set PB2 as output<br>    <br>    comparator_init();<br>    <br>    while (1) {<br>        // The hardware handles the comparison. <br>        // The CPU can do other work here.<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cab84489057" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ATtiny85 Interrupt — Overview]]></title>
            <link>https://medium.com/@jimmykzm94/attiny85-interrupt-overview-1308dff5e423?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1308dff5e423</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[attiny85]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 01:31:01 GMT</pubDate>
            <atom:updated>2026-04-28T01:31:01.415Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uvsv1OXMw9aLQYtWNatfcA.png" /></figure><p>Polling a pin or a timer in a continuous while loop wastes CPU cycles and battery power. Interrupts solve this by allowing the microcontroller&#39;s hardware to monitor events in the background.</p><p>When a specific hardware event occurs, the CPU immediately pauses its current task, jumps to an isolated block of code called an Interrupt Service Routine (ISR) to handle the event, and then resumes the main program exactly where it left off.</p><h3>📋 The Interrupt Vector Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HwaXe-cxQ6F3Cq3HoIuGaw.png" /><figcaption>Taken from the datasheet</figcaption></figure><p>Every interrupt source on the ATtiny85 has a dedicated “vector” — a specific memory address it points to. When an interrupt fires, the CPU looks at this table to know which ISR to execute.</p><p>Priority is strictly dictated by the vector number. The lower the number, the higher the priority. If two hardware events trigger at the exact same microsecond, the CPU will always execute the interrupt with the lower vector number first.</p><h3>🔄 Reset: The Ultimate Interrupt</h3><p>If you look at the top of your vector table screenshot, you will see that <strong>Vector 1 is RESET</strong>.</p><p>Technically, a system reset is just the highest-priority interrupt on the microcontroller. Whether it is triggered by initially applying power, manually pulling the PB5 Reset pin low, or the Brown-Out Detector (BOD) tripping due to a voltage drop, the CPU drops absolutely everything and jumps to the Reset vector.</p><p>Unlike standard interrupts that return to the previous task, this vector points to memory address 0x0000, effectively restarting your C program from scratch. Because it is Vector 1, no other interrupt can ever interrupt or override a reset sequence.</p><h3>🚦 Enabling and Disabling: The Two Switches</h3><p>To make an interrupt actually fire in C, two separate hardware switches must be explicitly turned on: the <strong>Local</strong> switch and the <strong>Global</strong> switch.</p><h4>The Local Switch (Peripheral Level) 🔘</h4><p>Every peripheral has its own dedicated configuration registers to enable its specific interrupt.</p><p>For example, if you want to trigger an interrupt when a user presses a button connected to <strong>PB2 (INT0)</strong>, you must configure the external interrupt registers. You tell the hardware to listen for a falling edge (the button being pressed to GND) using the MCUCR register, and then you flip the local switch for INT0 in the GIMSK register.</p><pre>// Configure Local Switch for a button press on PB2 (INT0)<br>// Set Interrupt Sense Control to trigger on a Falling Edge<br>MCUCR |= (1 &lt;&lt; ISC01);<br>MCUCR &amp;= ~(1 &lt;&lt; ISC00); <br><br>// Enable the INT0 external interrupt (The Local Switch)<br>GIMSK |= (1 &lt;&lt; INT0);</pre><h4>The Global Switch (CPU Level) 🌍</h4><p>Even if your local switch is perfectly configured, the CPU will completely ignore the button press unless the Global Interrupt Enable bit (the I bit in the CPU&#39;s Status Register, SREG) is turned on.</p><p>In AVR GCC, you control this master switch using two simple macros from &lt;avr/interrupt.h&gt;:</p><ul><li><strong>sei();</strong> (Set Interrupts) - Turns the global switch ON.</li><li><strong>cli();</strong> (Clear Interrupts) - Turns the global switch OFF.</li></ul><pre>#include &lt;avr/interrupt.h&gt;<br><br>void setup_button_interrupt(void) {<br>    // 1. Configure the Local Switch (INT0)<br>    MCUCR |= (1 &lt;&lt; ISC01);<br>    GIMSK |= (1 &lt;&lt; INT0); <br>    <br>    // 2. Turn on the Global Switch for the whole CPU<br>    sei();                 <br>}<br><br>// The ISR that runs when the button is pressed<br>ISR(INT0_vect) {<br>    // Handle the button press here (e.g., toggle an LED)<br>}</pre><h4><strong>Why would you ever disable them?</strong> 🛑</h4><p>Sometimes your main loop executes a “critical section” of code. If you are communicating with a timing-sensitive sensor or modifying a multi-byte variable that an ISR also relies on, you do not want the CPU jumping away to handle a button press right in the middle of it.</p><p>To protect the data, you temporarily call cli() to disable all interrupts, execute your sensitive code, and then immediately call sei() to turn them back on. Any interrupts that occur while the global switch is off are flagged by the hardware and will execute immediately the moment you call sei().</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1308dff5e423" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ATtiny85 ADC — Potentiometer]]></title>
            <link>https://medium.com/@jimmykzm94/attiny85-adc-potentiometer-27c60afec9ea?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/27c60afec9ea</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[attiny85]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 02:31:01 GMT</pubDate>
            <atom:updated>2026-04-27T02:31:01.497Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uvsv1OXMw9aLQYtWNatfcA.png" /></figure><h3>🔌 The Hardware Setup</h3><p>A potentiometer acts as a simple voltage divider. By turning the knob, you change the resistance, which varies the voltage on the middle pin between 0V and your supply voltage (VCC​).</p><p>Here is how we wire it up:</p><ul><li><strong>Pin 1 (Outside leg):</strong> Connect to VCC​ (e.g., 5V).</li><li><strong>Pin 3 (Outside leg):</strong> Connect to GND.</li><li><strong>Pin 2 (Middle wiper):</strong> Connect to <strong>PB3 (ADC3)</strong> on the ATtiny85.</li></ul><h3>🛠️ Configuring the Registers</h3><p>To read that fluctuating voltage on PB3, we need to configure two main registers: ADMUX and ADCSRA.</p><h4><strong>Setting up ADMUX (Multiplexer Selection)</strong></h4><p>We need to tell the ADC which pin to listen to and what our reference voltage is.</p><ul><li><strong>Voltage Reference:</strong> We will use VCC​ as our baseline, which is the default setting (REFS[2:0] = 000).</li><li><strong>Channel Selection:</strong> We wired our potentiometer to PB3, which maps to <strong>ADC3</strong>. Looking at the datasheet, selecting ADC3 means setting both the MUX1 and MUX0 bits to 1.</li></ul><h4>Setting up ADCSRA (Control and Status)</h4><p>Next, we turn the ADC on and set the clock speed.</p><ul><li><strong>Enable:</strong> Set the ADEN bit to 1 to power up the ADC module.</li><li><strong>Prescaler:</strong> Our system clock is 8MHz, but the ADC needs a clock between 50kHz and 200kHz. We will set a prescaler of 64 to divide our 8MHz down to a perfect 125kHz. This requires setting the ADPS2 and ADPS1 bits.</li></ul><h3>💻 The Code</h3><pre>#include &lt;avr/io.h&gt;<br>#include &lt;stdint.h&gt;<br><br>void adc_init(void) {<br>    // 1. Configure ADMUX<br>    // VCC used as analog reference (default, no bits need setting)<br>    // Select ADC3 (PB3) by setting MUX1 and MUX0<br>    ADMUX = (1 &lt;&lt; MUX1) | (1 &lt;&lt; MUX0); <br>    <br>    // 2. Configure ADCSRA<br>    // Enable the ADC module (ADEN)<br>    // Set prescaler to 64 (ADPS2 and ADPS1) -&gt; 8MHz / 64 = 125kHz<br>    ADCSRA = (1 &lt;&lt; ADEN) | (1 &lt;&lt; ADPS2) | (1 &lt;&lt; ADPS1); <br>}<br><br>uint16_t adc_read(void) {<br>    // Start a single conversion by setting the ADSC bit<br>    ADCSRA |= (1 &lt;&lt; ADSC);<br>    <br>    // Wait for the conversion to complete<br>    // The ADSC bit will be cleared by hardware when finished<br>    while (ADCSRA &amp; (1 &lt;&lt; ADSC)) {<br>        // Polling loop: do nothing until the bit flips to 0<br>    }<br>    <br>    // Return the 10-bit result<br>    // Note: AVR GCC allows reading the 16-bit &#39;ADC&#39; register macro directly, <br>    // which automatically handles reading ADCL and ADCH in the correct order.<br>    return ADC; <br>}<br><br>int main(void) {<br>    // Initialize the ADC once<br>    adc_init();<br>    <br>    uint16_t pot_value = 0;<br><br>    while (1) {<br>        // Continuously read the potentiometer value (0 to 1023)<br>        pot_value = adc_read();<br>        <br>        // Use pot_value here (e.g., feed into an algorithm or control hardware)<br>    }<br>    <br>    return 0;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27c60afec9ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ATtiny85 ADC — Overview]]></title>
            <link>https://medium.com/@jimmykzm94/attiny85-adc-overview-094da1e24364?source=rss-d730a677112e------2</link>
            <guid isPermaLink="false">https://medium.com/p/094da1e24364</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[attiny85]]></category>
            <dc:creator><![CDATA[Jimmy Kueh]]></dc:creator>
            <pubDate>Sat, 25 Apr 2026 01:31:01 GMT</pubDate>
            <atom:updated>2026-04-25T01:31:01.428Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uvsv1OXMw9aLQYtWNatfcA.png" /></figure><p>Whether you’re reading a simple potentiometer, logging data from an analog temperature sensor, or keeping an eye on your battery voltage, the ADC is your MCU’s bridge to the messy, real-world analog environment.</p><h3>What are the Features? 🔍</h3><p>For an 8-bit micro with so few pins, the ATtiny85’s ADC is surprisingly feature-rich. It shares a lot of DNA with its larger ATmega siblings but has a few unique tricks up its sleeve. Here is a rundown of what this peripheral brings to the table:</p><h4>🎯 <strong>10-bit Resolution:</strong></h4><p>By default, the ADC gives you a 10-bit result, meaning it maps analog voltages to integer values between 0 and 1023. If you don&#39;t need that much precision and want to save memory or processing cycles, you can easily left-adjust the result to read it as a fast 8-bit value (0 to 255).</p><h4>🔀 <strong>4 Multiplexed Single-Ended Channels</strong></h4><p>You get four dedicated analog input pins to choose from:</p><ul><li>ADC0 (PB5 / Reset pin - <em>use with caution!</em>)</li><li>ADC1 (PB2)</li><li>ADC2 (PB4)</li><li>ADC3 (PB3)</li></ul><h4>⚖️ <strong>Differential Channels with Programmable Gain</strong></h4><p>This is a fantastic feature for such a small chip. You can measure the voltage <em>difference</em> between two pins (e.g., ADC2 and ADC3). Even better, it includes a programmable gain amplifier (PGA) allowing you to multiply that differential signal by <strong>1x</strong> or <strong>20x</strong> before conversion — perfect for amplifying tiny signals like those from a current shunt resistor.</p><h4>🌡️ <strong>Internal Temperature Sensor</strong></h4><p>The chip features an internal, on-chip temperature sensor tied to a dedicated internal ADC channel (ADC4). It requires calibration to be highly accurate, but it’s great for detecting relative temperature shifts.</p><h4>🔋 <strong>Multiple Voltage References</strong></h4><p>To measure a voltage, the ADC needs a baseline reference. The ATtiny85 lets you choose from:</p><ul><li><strong>VCC</strong> (the supply voltage).</li><li><strong>Internal 1.1V</strong> reference.</li><li><strong>Internal 2.56V</strong> reference.</li><li><strong>External reference voltage</strong> applied to AREF (PB0).</li></ul><h4>⏱️ <strong>Prescaler &amp; Clocking</strong></h4><p>The ADC needs a clock between 50 kHz and 200 kHz to achieve its maximum 10-bit resolution. Since we are running at an <strong>8MHz system clock</strong>, we can’t feed that directly into the ADC. The built-in prescaler handles this beautifully. By setting the prescaler to 64, we divide our 8MHz clock down to a perfect <strong>125 kHz</strong> (8,000,000/64=125,000).</p><h4>🔄 <strong>Conversion Modes</strong></h4><p>You can trigger conversions manually (Single Conversion mode), set it to run continuously (Free Running mode), or trigger conversions based on hardware events (Auto Triggering) like timers or external interrupts.</p><h4>🔔 <strong>Interrupt-Driven</strong></h4><p>You can configure the ADC to fire an interrupt the exact moment a conversion finishes, freeing up your CPU to do other things instead of blocking and waiting in a while loop.</p><h4>🔕 <strong>ADC Noise Canceler</strong></h4><p>To get the cleanest possible reading, a special sleep mode halts the CPU and all digital I/O modules during a conversion, preventing digital switching noise from distorting the sensitive analog result.</p><h3>⚙️ The Registers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QD7b0ofwfpx5DHChzvpnjQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=094da1e24364" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>